Reputation: 1939
I have the following:
Textfield called: WoNr
Table column called: Workorder
= DMax("[WoNr]","[Workorder]","[Workorder]") + 1
In the text field named WoNr I have entered the code above, I get an error.
Why is this?
Upvotes: 0
Views: 2968
Reputation: 172390
Why are you using "[Workorder]"
as the criterion (i.e., the last parameter)? Try the following:
= DMax("WoNr", "Workorder")
If this works, continue reading.
Now about the "+ 1" thing. You say that WoNr is a text field (rather than a numeric field). So, what do you want to get? Do you want to append "1" to the string (WoNr = "D1" => Result = "D11") or is WoNr actually a numeric value and you want to add 1? In any case, you should make your intention clear. For string concatenation, use &
:
= DMax("WoNr", "Workorder") & "1"
for arithmetic operations, convert your text into an appropriate numeric data type first:
= CLng(DMax("WoNr", "Workorder")) + 1
Upvotes: 1