How do I open a form ready for next entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm using a very simple database that calls a form for people to enter data.
The primary key is also the "part number" in format 1025-****. I would like
to be able to open the form with the next Primary Key number already entered
in a text box.
How do I find the 'last' primary key value and can I just add 1 to index it?

Thanks in advance
 
Based on your post, it appears you will opening the form once for each
record. Is that what you really want?

If so, this would go in your form's Open event :

strNxtNbr = DMAX("[PartNumber]","PartNumberTable")
lngNext = CInt(Right(strNxtNbr,4)) + 1
strNxtNbr = Left(strNxtNbr,5) & Format(lngNext,"0000")

If the users will be making more than one entry per session, then put the
above in the On Current event of your form.
 
Back
Top