Field to copy from previous record

kbrooks

Still learning
Local time
Today, 12:11
Joined
May 15, 2001
Messages
202
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!
 
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).]
 
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!
 
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!!!
smile.gif
 

Users who are viewing this thread

Back
Top Bottom