cancel event if data change

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi there,

I have a main form with a sub-form and code at the before update event on
the date field under the main form, I would like to bypass/cancel the before
update event if the user change the date after entry.
I mean that when the user enter the date (new record), the before update
event wil be executed. If the user change the date (immediately or after
record saved), I would lite to bypass/cancel the before update event. Hope
this clear for you.
Appreciate for your expert comments. Thanks in advance!
 
Hi there,

I have a main form with a sub-form and code at the before update event on
the date field under the main form, I would like to bypass/cancel the before
update event if the user change the date after entry.
I mean that when the user enter the date (new record), the before update
event wil be executed. If the user change the date (immediately or after
record saved), I would lite to bypass/cancel the before update event. Hope
this clear for you.
Appreciate for your expert comments. Thanks in advance!

Are you trying to keep the user from changing the date, once it has
been added?
 
Hi,

The event will create a unique invoice number automatically. If the date
changed, the invoice number will be changed as well. Any comments? Thanks!
 
Hi,

The event will create a unique invoice number automatically. If the date
changed, the invoice number will be changed as well. Any comments? Thanks!






- Show quoted text -

Can you alter the routine that adds the invoice number to only add the
invoice number if the invoice number is null?

If isNull([InvoiceNumber]) Then
cInvoiceNumber = DLookup("tblSystem","LastInvoiceNumber")
db.execute "UPDATE tblSystem SET [LastInvoiceNumber] =
cInvoiceNumber + 1"
Endif
 
Hi,

Good idea! Thank you very much!

OldPro said:
Hi,

The event will create a unique invoice number automatically. If the date
changed, the invoice number will be changed as well. Any comments? Thanks!










- Show quoted text -

Can you alter the routine that adds the invoice number to only add the
invoice number if the invoice number is null?

If isNull([InvoiceNumber]) Then
cInvoiceNumber = DLookup("tblSystem","LastInvoiceNumber")
db.execute "UPDATE tblSystem SET [LastInvoiceNumber] =
cInvoiceNumber + 1"
Endif
 
And if you do ever do need to execute code only if a rercord is new

If Me.NewRecord Then
'Code goes here
End If


Linq

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Back
Top