Ref:Create Autonumber

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

I read the entry the used the DMAX function to
autoincrement, I tried to use this in my program:
rst!ReferenceNumber = DMax([ReferenceNumber]) + 1

The program highlights DMax and says Argument Not Optional

Any help?
 
You need to include the name of the table that [ReferenceNumber] is in.

DMax([RefernceNumber],"NameOfTable")+1

Kelvin
 
I read the entry the used the DMAX function to
autoincrement, I tried to use this in my program:
rst!ReferenceNumber = DMax([ReferenceNumber]) + 1

The program highlights DMax and says Argument Not Optional

The DMax function has two required arguments, both text strings: the
name of the field for which you want to find the maximum value, and
the name of the Query or Table containing that field. The third
optional argument is another text string, a valid SQL WHERE clause
without the word WHERE limiting which records are searched.

If your table is named MyTable, the syntax would be

rst!ReferenceNumber = DMax("[ReferenceNumber]", "MyTable") + 1
 
Kim,

.... and you need to put ""s around the field name...
DMax("[ReferenceNumber]","NameOfTable") + 1

- Steve Schapel, Microsoft Access MVP
 
Back
Top