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

automatically find the next available number?

Status
Not open for further replies.

wshm

Programmer
Dec 7, 2006
62
0
0
US
How do I use DLookUp to find the next number?
ie.
tbl_PSC
contractno | addendumno
test00 | 00
test00 | 01

I have a form "frm_PSCupdate"
I have a combobox where user can select the contract they want to update.
if they choose "test00" from cboContNo
i want 'txtAddedumNo' to automatically update to
"02". How can i find that next available number?

 
In the AfterUpdate event procedure of cboContNo:
Code:
Me!txtAddedumNo = Format(1 + Nz(DMax("addendumno", "tbl_PSC" _
  , "contractno='" & Me!cboContNo & "'"), -1), "00")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top