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.
 

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

Back
Top