Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jan 2003
    Location
    Renfrewshire, Scotland
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Populating fields in forms (Word 97 SP2)

    Good Evening!

    I am currently updating some Word forms and want to be able to populate some fields from previous entries. I'm hoping to be able to link login details (win2K) to a text file so that the form will recognise the person that has logged in - and will prefill some of the information on the form. I also would like to prompt a user that has never logged onto that specific machine for some information that can be used in the form.

    Hopefully I've come to the right place for some well needed direction!

    Thanks for any help

    Alba

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    Would you consider using the Registry to store the information? I have several classes that
    push and pull from the registry -- which I prefer to .ini files. If you search this forum, you'll find
    biases both ways. The new thing is storing all such settings in XML files. But wait for the .net
    version of VBA (VSTO) before jumping into that one.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    Kevin,

    Using the registry might depend on how the registry is set up.

    On our site, the registry is machine specific, not user specific. So we use ini files on the users' network personal folders.

    We have another problem. Many bosses do not fill in their own forms- thay have their PA do it for them. The PA will also have to fill in forms for themselves; the may also be working for mor ethan one person. We give them the ability to switch from one user to the other, carrying all personal information with them.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    What kind of logon details? The last person logged on and that sort of thing?
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    >>On our site, the registry is machine specific, not user specific

    Geoff,

    I don't quite understand that statement. The reg hives HKEY_Current_User and
    HKEY_Local_Machine exist on all Windows PCs, don't they?

    I solved the user1 doing work for/as user2 by building the hooks into the app
    to allow "impersonation" via the form prompts.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    2 Star Lounger
    Join Date
    Jan 2003
    Location
    Renfrewshire, Scotland
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    Sounds as though I may have bitten off more than I can chew....I've had a chance to think about it a bit more, and had realised that our bosses can't type either and the secretaries can be working for up to 6 people at a time.

    So what I thinking is to compare the username of the person logged on, with an .ini file. The first time a person logs on and opens one of the forms they will be prompted to fill out some basic information - which is then written to the .ini file and stored for the future. This info in turn can then be used to populate fields in a number of templates.

    Sounds OK so far?

    But I'm curious as to how you can prompt the user to switch to become another user or to "impersonate" another user? I was thinking of a locally stored .ini file, so how do you get round the problem of updating the file on everyone's machine when someone new starts?

    Sorry if I appear dim, but I don't want to go down the wrong route.....

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Populating fields in forms (Word 97 SP2)

    Hey, none of that dim business. That's a VB reserved word, so lay off.

    All your questions have been just fine.

    ...and here's how it's done:

    See that drop down (combo btn) for Name: behind that button
    is the entire employee list. Any user can change
    that to whomever they like. If you need any restrictions, that's easy
    enough to code up. All the basic user profile info is stored in a
    centralized db and pulled in from there to the form. The user's choices
    are then stuffed into the HKEY_Current_User hive for the app.

    The beauty of the registry is it holds these values
    in place of global variables and since the registry is cached, access
    is very fast. I made it easy for the user: as soon as they pick a name
    from the list, all the other fields populate.

    Wrap all this up in a couple class mods and you can
    reference any profile setting like this:

    txtName.Text = oPro.Fullname
    Attached Images Attached Images
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •