I’ve got this form in an Access database into which people enter data, but only once a day. Basically it records their login, date, and one or two other pieces of data that they type in.
What I need is an event proceudure that checks the table to see if data has already been entered by that agent for that day, and if it does, close the form and open a different form instead. Now I know I’ve done this before…in fact, I’ve got a functioning database where it works. But this is the event procedure that’s in that form, and I can’t figure out why it works:
Private Sub Form_Load()
If validation.Value = GetLoginName() Then
DoCmd.OpenForm “Menu”, acNormal
DoCmd.Close acForm, "DataEntryForm", acSaveNo
Else
DoCmd.GoToRecord , , acNewRec
End If
End Sub
It definitely works, but when I try to copy the code over to a different database, I get an error around the validation.Value. So I know I figured this out, probably five or six years ago, but I can’t remember how, and even stealing the old code for the new database doesn’t work. I don’t have any objects named ‘validation’, in either database, so I’m not sure what validation.Value refers to.
Anyone have experience with this that can help me out? I’ve been away from Access for quite a few years now, but the boss wants this done in Access so I’m stuck trying to remember it all.