Reputation: 144
So I have literally used the same code format on 4 other Forms:
Here's the working code from those three forms :
=DMax("ID","tbl_Users")+1
=IIf([lst_DeviceType].[Column](0)="Cell Phone",DMax("DeviceNum","tbl_Cell_Tab","DeviceNum < 70000")
+1,DMax("DeviceNum","tbl_Cell_Tab")+1)
=IIf([frm_type]=0,DMax("DeviceNum","tbl_PC_Lap","DeviceNum < 100000")+1,IIf([frm_type]=1,
DMax("DeviceNum","tbl_PC_Lap","DeviceNum < 50000")+1,DMax("DeviceNum","tbl_PC_Lap","DeviceNum < 40000")+1))
=DMax("DeviceNum","tbl_Printers")+1
The goal here is to pull the current largest number in the Key from the table and from it get the next one in line so as to be calculated and stored for use later in a module that will audit changes to the tables. So I am using the format DMax("DeviceNum", TABLENAME) + 1
My latest form won't accept this format, instead throwing #Error
=DMax("DeviceNum","tbl_ThinClients")
And for the life of me I can not figure out why I keep getting this. I have deleted the textbox, and recreated it.
Here's a snip of the table in design mode
Here's a snip of one of the tables it works with
Any ideas as to why? I mean the only difference I see is that the Printers is a "Large Number" Data type (Values > 80000)
Upvotes: 1
Views: 214
Reputation: 144
So apparently, though I don't know why, you can't DMax Large Number fields. The solution was to set it to a "Number" and use that.
Upvotes: 1