kbrooks
11-21-2001, 07:06 AM
I have a form with 3 fields for each record....UserID, ApplicationID, and FunctionID. I'm entering multiple records for each user and am trying to get whatever UserID I entered last to default in the field on the current record.
For instance if I entered
UserID:kbrooks
ApplicationID:PA
FunctionID:PA001
When I tab to the next record, I'd like kbrooks to default into the UserID field. Is this possible? Thanks for any help!
Jack Cowley
11-21-2001, 04:19 PM
In the After Update event of the UserID field put code like this:
Me![UserID].Tag = Me![UserID].Value
In the On Enter Event of the same field put code like this:
If Not Me.NewRecord Then Exit Sub
If Not (IsNull(Me![UserID].Tag) Or Me![UserID].Tag = "") Then
Me![UserID].Value = Me![UserId].Tag
End If
The UserID will not carry over into your next session with the form but will work as long as the form is open....
[This message has been edited by Jack Cowley (edited 11-21-2001).]
kbrooks
11-23-2001, 05:57 AM
Thank you for your help. I ran into a snag, though. I entered the code as you typed it, but I get an error message when I enter a UserID on the form. The message is :
"Microsoft Access can't find the macro 'Me!UserID."
Any ideas? Thanks in advance!
kbrooks
11-23-2001, 06:00 AM
Never mind, Jack! I must've typed something wrong because when I re-did it, it works exactly like I want it to.
Thanks a lot!!! http://www.access-programmers.co.uk/ubb/smile.gif