DLookup/Dmax function error after append query (1 Viewer)

Wysy

Registered User.
Local time
Yesterday, 22:38
Joined
Jul 5, 2015
Messages
333
Hi,
I have the following problem that emerged in my database.
I have a table with alphanumeric id. I need to know the last one when i enter new data using an entry form. So on the entry form i have an unbound control with Dlookup/Dmax function. The function runs on a query based on the given table. Everything worked fine until i have ran an append query than added records to this table. The combined Dlookup/Dmax function results in an error.
So i copied the table, deleted all records and with copy/paste i entered all data again. Function works now. I suppose something with the primary key happened that has an autonumber field.
The combined Dlookup/Dmax function looks up a value from the query where a serial number has its max:
=DLookUp("[HUN_ID]","qrLastIMfrmCSBJ","Year=2019 And Serial=" & DMax("Serial","qrLastIMfrmCSBJ","Year='2019'"))

So my very question is why this happens? The append query did not have any autonumbered field just data for the first two columns of the table.
If the problem is caused by the autonumber field how can i restore the primary key?
thank you
regards
Andrew
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:38
Joined
May 7, 2009
Messages
19,233
you have Year=number and the last, Year=string.
which one is correct?
 

Users who are viewing this thread

Top Bottom