=DMax("tblDemoTrans","RecordNum")+1 . It is a number field.What is the expression you are using? What type of field is RecordNum? Integer? Autonumber?
Currently I am getting an error with this code =DMax("tblDemoTrans","RecordNum")+1Are you trying to store something based on a "DMax() + 1" type of formula?
For "Doesn't work" the question is, then what does it actually do?
For "same number" that means that something didn't get stored or didn't get incremented BEFORE it was stored. (We can't tell which of those two from here.)
Already been advised of not incrementing in the other forum Doc.Are you trying to store something based on a "DMax() + 1" type of formula?
For "Doesn't work" the question is, then what does it actually do?
For "same number" that means that something didn't get stored or didn't get incremented BEFORE it was stored. (We can't tell which of those two from here.)
what does that mean. I could not find my other post.Already been advised of not incrementing in the other forum Doc.![]()
Currently I am getting an error with this code =DMax("tblDemoTrans","RecordNum")+1
From https://learn.microsoft.com/en-us/office/vba/api/access.application.dmaxCode:' Typical Use ' Numerical values. Replace "number" with the number to use. variable = DMax("[FieldName]", "TableName", "[Criteria] = number")
Why are you trying to do this instead of having "RecordNum" be autonumbered?=DMax("tblDemoTrans","RecordNum")+1 . It is a number field.
Already advised on the first reply on other site?
Speculating it might be a customer-facing transaction ID and not the PK for the table.Why are you trying to do this instead of having "RecordNum" be autonumbered?
I'd also give it a better name than "RecordNum". DemoTrans_ID may be a better name as it makes it very apparent it is the primary key for the DemoTrans table, the main reason you use an autonumbered field.
You got the table and field reversed. I don't think this is a PK.=DMax("tblDemoTrans","RecordNum")+1 . It is a number field.
=DMax("RecordNum","tblDemoTrans")+1
=DMax("tblDemoTrans","RecordNum")+1 . It is a number field.
Normally when I see DMax() used for customer facing numbers it is stored as a "PO" or "Receipt" number rather than "RecordNum". Hence the question as I'd hate to think OP is trying to reinvent fire!Speculating it might be a customer-facing transaction ID and not the PK for the table.