i tried it another textbox named txtdate.txtDate = DLookup("PRDDATE", "MDFPRD", "ID = " & DMax("ID", "MDFPRD", "ID < " & Me.ID))
Our posts are crossing. Note that the red/blue parts are associated with each other.
Firstly, I after looking at your table pic I realized that you need a date based based on the ID that is the highest value but is less than the current record ID value.
So post your actual code or see what happens if you put in any valid ID number instead, such as
txtDate = DLookup("PRDDATE", "MDFPRD", "ID = 5"). Also, form must have the ID field on it, otherwise Me.ID will raise an error. If not there, try adding it (you don't have to make it visible). The PK field should always be on a form/report in case it becomes necessary - such as in this case.
EDIT - company coming; not sure how much time I will have for this today.
I am very very apology due to last night confusion..txtDate = DLookup("PRDDATE", "MDFPRD", "ID = " & DMax("ID", "MDFPRD", "ID < " & Me.ID))
Our posts are crossing. Note that the red/blue parts are associated with each other.
Firstly, I after looking at your table pic I realized that you need a date based based on the ID that is the highest value but is less than the current record ID value.
So post your actual code or see what happens if you put in any valid ID number instead, such as
txtDate = DLookup("PRDDATE", "MDFPRD", "ID = 5"). Also, form must have the ID field on it, otherwise Me.ID will raise an error. If not there, try adding it (you don't have to make it visible). The PK field should always be on a form/report in case it becomes necessary - such as in this case.
EDIT - company coming; not sure how much time I will have for this today.