C
CW
I have a button that when clicked, saves the form (the header of an invoice)
and allocates the next number. My code is as follows:
Private Sub cmdSaveInvHeader_Click()
On Error GoTo Err_cmdSaveInvHeader_Click
Me.InvNo = Nz(DMax("[InvNo]", "[tblInvoices]")) + 1
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_cmdSaveInvHeader_Click:
Exit Sub
Err_cmdSaveInvHeader_Click:
MsgBox Err.Description
Resume Exit_cmdSaveInvHeader_Click
End Sub
Trouble is, if the button is clicked twice, naturally it will allocate two
numbers and one of the forms then has to be cancelled and we end up with void
invoices in our sequence.
Is there some way to suppress a second click, or rather the consequence of a
second click, so that only one number at a time can be allocated/saved?
(I suppose I could make the firing action a little more deliberate and less
prone to accidental activation, such as a double-click, but I would prefer to
exclude the possibility altogether, if I can).
Many thanks
CW
and allocates the next number. My code is as follows:
Private Sub cmdSaveInvHeader_Click()
On Error GoTo Err_cmdSaveInvHeader_Click
Me.InvNo = Nz(DMax("[InvNo]", "[tblInvoices]")) + 1
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_cmdSaveInvHeader_Click:
Exit Sub
Err_cmdSaveInvHeader_Click:
MsgBox Err.Description
Resume Exit_cmdSaveInvHeader_Click
End Sub
Trouble is, if the button is clicked twice, naturally it will allocate two
numbers and one of the forms then has to be cancelled and we end up with void
invoices in our sequence.
Is there some way to suppress a second click, or rather the consequence of a
second click, so that only one number at a time can be allocated/saved?
(I suppose I could make the firing action a little more deliberate and less
prone to accidental activation, such as a double-click, but I would prefer to
exclude the possibility altogether, if I can).
Many thanks
CW