For some reason I have to press PgDn twice or click on the navigation button at the bottom of the screen on my data entry form twice every time I want to go to the next record. What could be causing this?
For some reason I have to press PgDn twice or click on the navigation button at the bottom of the screen on my data entry form twice every time I want to go to the next record. What could be causing this?
More information on my question. I discovered this only happens when I have the following code entered for the field just prior to the AQID field:
Private Sub Date_received_LostFocus()
AQId.Value = "AQ" & Format(Str([RecId]), "00000")
End Sub
The field RecId is an autonumber field. The code puts the value above into the AQId field so the user doesn't have to enter it manually. It works, but for some reason it causes me to have to press PgDn twice or click on the navigation key twice to go to the next record. What am I doing wrong?
Just a hunch, but what happens if you use:
AQId.Value = "AQ" & Format(Str([RecId]), "00000")
Me.Dirty = False
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
The Str() function is not necessary, although it shouldn't hurt.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The code you suggested might have worked, but before I saw your post I tried moving my code from the Lost Focus of the previous field to the Got Focus of its own field. My problem disappeared. I was just trying to make the field not a tab stop so the user wouldn't even have to go to that field and try to change the value on their own. I'm sure there's another way to prevent someone from changing the value but I'll keep working on that. If you have a suggestion for that I'd appreciate it. Thanks for taking the time to offer your suggestion.
I wanted to let you know I changed my code back to the Lost Focus of the previous field, added your line of code (Me.Dirty - False), the changed the AQId field to not be a tab stop and to be locked. Now my original problem is solved plus the user can't change the value in the field. Thank you so much for this suggestion. It was right on!