Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use DMax in a query

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi folks,
I try to make a query with a Dmax in it. But I don't know how. This is what I come up with so far.

Code:
InvoiceNew: IIf([InvoiceNo] Is Null;DMax([InvoiceNo])+1;[InvoiceNo])


Pampers.

You're never too young to learn
 
Perhaps this ?
InvoiceNew: 1+Nz(DMax([InvoiceNo]),0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OOps, hit submit toofast :~/
Perhaps this ?
InvoiceNew: 1+Nz(DMax("InvoiceNo","yourTable"),0)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,
tnx for the reply
It works, but my idea is wrong. I want to create unique invoice numbers when the rptInvoice is opened (based on qryInvoice. (Uptill now I assigned InvoiceNo in the form with DMax. It works, but when two users are entering InvoiceInformation, it will create duplicate InvoiceNo.)

Mabye it has to be an update query...
but doesn't work either. The udatequery takes the highest number adds 1, and put this number back for all the empty invoiceno...
Suggestions?


Pampers.

You're never too young to learn
 
Does splitting the database (be - fe) solve such a problem?


Pampers.

You're never too young to learn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top