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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a table tblInvoice, in which

Status
Not open for further replies.

slames

Technical User
Nov 5, 2002
211
GB
I have a table tblInvoice, in which 2 of the fields are invSeries and invNumber. I need to implement code to search these fields to find the highest number present where the invSeries is equal to user input. Once the highest number has been found, I need to add one and assign it as a new record in that table. My main problem is finding the highest number in that field, does anyone have any suggestions on how to do this?
Thanks
Steph
 
You can use DMax function...

eg.

intMax = DMax("fldField", "tblTable", "WHERE fldFieldTwo = " value )

This will return the maximum value in fldField from tblTable where fldFieldTwo = value

There are two ways to write error-free programs; only the third one works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top