Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing "CurrentUser" in the table from a Form

Status
Not open for further replies.

Chris1977

Technical User
Feb 2, 2003
50
US
I know I've seen this donne before but I'm not sure how they did it. What I want to do is record the username of the user just logged into access in a record that is currently being added.

Presently I have anopening form that display a combo box of available names. I've tried setting the default value to CurrentUser()but that won't work because the combo box stores a number. Now, if memory serves the way it was done before was that the combo box was on a form other than the startup form and given a default value of =[Forms]![Main].[ISSPdec]. ISSPdec was a variable assigned a value in the "on open" event of startup form.

I tried something similar but can't get it to work. Does anyone have any ideas on how I can have a user log into the database and as they enter records have the it record that it was that user that entered it. Presently they pick from a dropdown.

Thanks
 
Chris, try setting the option to save the data and not the number in the dropdown/combo box. Then open a new form, hide it and put this user's name on that form. Then you can always referece that form when doing an add/delete/update.
 
Try creating a macro and use the transfer spreadsheet oprtion.
 
Chris,

Great question, I've implemented this feature into many of my own databases, as a matter of fact. First, in order to use CurrentUser() the database must be fully secured and properly. Without a secured database, everyone is Admin, so it wouldn't make a difference if you did use CurrentUser().

Second, create a text field (not a combobox) on the form, and make it a bound field to a field in the table that stores the user name. Plain old text field is what you need.

Third, make CurrentUser() the default for that field and while you're in design view, hide the field (visible=false).

What basically happens with this example is that a user will open up the form, put in their information, and go to the next record, etc. etc. Each time there is a field that is automatically filling in with their log-in name and getting stored in the table field.

Good luck!

David Badurina
Free Newsletter? NO WAY!
 
Does anyone have the answer to Chris1977 question? Thanks, cuz I also want to learn this too.

I Hate Spammers and Flammers!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top