cancel event if data change

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!
 
O

OldPro

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?
 
A

Andy

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!
 
O

OldPro

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
 
A

Andy

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
 
L

Linq Adams via AccessMonster.com

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
 

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

Top