P
Paul James
I'm building an accounting system that tracks Invoices, and I'm using an
Autonumber field to generate the Invoice ID.
If a user starts entering an invoice but presses "Esc" before the record is
saved, that record, including the Autonumber InvoiceID disappears from the
form. But then when the user starts entering another invoice in the form,
the Invoice ID will go to the next Autonumber, and the previous number will
be absent from the Invoice ID sequence.
For auditing purposes, I would prefer to have a record for all Invoice ID
numbers, even those that the user "escaped" from. In that case, I'd just
like to mark that Invoice record as Void.
I've got the Allow Deletions property of the form set to No.
I figured that the best way to overcome the disappearing Invoice records
would be to save the record as soon as the makes a change of any kind to any
control in the form, which is when the new Autonumber / InvoiceID is
created. So I tried the following:
Private Sub Form_BeforeInsert(Cancel As Integer)
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
However, if the user presses "Esc" after entering several characters, the
record still disappears from the form, while the Autonumber notches up
another increment, but the "escaped" record never makes it to the table, and
that voided record is missing from the Invoice table.
Can anyone tell me how I can save these"escaped" invoices as records in the
Invoice table?
Thanks in advance,
Paul
Autonumber field to generate the Invoice ID.
If a user starts entering an invoice but presses "Esc" before the record is
saved, that record, including the Autonumber InvoiceID disappears from the
form. But then when the user starts entering another invoice in the form,
the Invoice ID will go to the next Autonumber, and the previous number will
be absent from the Invoice ID sequence.
For auditing purposes, I would prefer to have a record for all Invoice ID
numbers, even those that the user "escaped" from. In that case, I'd just
like to mark that Invoice record as Void.
I've got the Allow Deletions property of the form set to No.
I figured that the best way to overcome the disappearing Invoice records
would be to save the record as soon as the makes a change of any kind to any
control in the form, which is when the new Autonumber / InvoiceID is
created. So I tried the following:
Private Sub Form_BeforeInsert(Cancel As Integer)
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
However, if the user presses "Esc" after entering several characters, the
record still disappears from the form, while the Autonumber notches up
another increment, but the "escaped" record never makes it to the table, and
that voided record is missing from the Invoice table.
Can anyone tell me how I can save these"escaped" invoices as records in the
Invoice table?
Thanks in advance,
Paul