Help with DMAX criteria

G

Guest

Hi

I have a form to add new records and need to generate the next number in the
sequence. Works fine wothout any criteria but client now wants a 'dummy'
record with number 9999 so I want to exclude that using criteria. Highest
number in use is 254 so I want next number to be 255.
I have this in the Default Value
=DMax("[Customer Number]","[Contacts]","<9999")+1
which results in error. Is my criteria expressed incorrect or can't I do
this? Help much appreciated.

Sheila
 
W

Wayne Morgan

You need to tell it which field should be <9999. The criteria does not have
to refer to the field in the first argument and so it doesn't assume that to
be the case as a default.

Example:
=DMax("[Customer Number]","[Contacts]","[Customer Number]<9999")+1
 
G

Guest

How stupid of me, thank you Wayne

Wayne Morgan said:
You need to tell it which field should be <9999. The criteria does not have
to refer to the field in the first argument and so it doesn't assume that to
be the case as a default.

Example:
=DMax("[Customer Number]","[Contacts]","[Customer Number]<9999")+1


--
Wayne Morgan
MS Access MVP


Sheila D said:
Hi

I have a form to add new records and need to generate the next number in
the
sequence. Works fine wothout any criteria but client now wants a 'dummy'
record with number 9999 so I want to exclude that using criteria. Highest
number in use is 254 so I want next number to be 255.
I have this in the Default Value
=DMax("[Customer Number]","[Contacts]","<9999")+1
which results in error. Is my criteria expressed incorrect or can't I do
this? Help much appreciated.

Sheila
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top