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!

how to update form on opening

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi
On an invoice form I have used this code to generate invoice numbers
Me.InvoiceNumber = Nz(DMax("InvoiceNumber", "Accounts08"), 0) + 1

What I have noticed is that the invoice number does not appear in the table until the invoice is saved.
I need to have 2 people invoicing at the same time, without duplicating the invoice number.
I have tried using this code as follows
Code:
Private Sub Form_Current()
Me.InvoiceNumber = Nz(DMax("InvoiceNumber", "Accounts08"), 0) + 1
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub

While this works and adds the invoice number into the table it skips an invoice number eg:41026 and then 41028.

Without the [blue]save[/blue] command it gives consecutive numbers.

How can I have two people invoicing at the same time so that each invoice runs consectively without duplicating the same invoice number

Many thanks..kp




 
You may want to look at Faq700-184 in the discussion of locking the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top