MS Access VBA

I have a form with a Textbox that I would like to retrieve the value from the previous record from.
To get that previous value, I would have to show that the value was the same as the record with current ID -1.
How would I show that in vba?
deer777Asked:
Who is Participating?
 
mbizupConnect With a Mentor Commented:
Perhaps use this as a control source?

= DLookup("YourFieldName", "YourTable", "ID = " & DMax("ID", "YourTable", "ID < " & [ID]))

Open in new window


That should retrieve the value of the field in question corresponding to the maximum ID that is less than the current ID.  (Simply retrieving records with current ID -1 may not work as expected if your table has deleted or otherwise missing records)
2
 
Dale FyeConnect With a Mentor Commented:
or if this is a multi-user database, and multiple users could create records.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.