By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

data change event

P: 52
Hi

I'm using buttons on a form to pass a given record to the current form, the data passes just fine to the form. When the data in the form changes I would like to run a check to see if a particular control = x then based on the result run a set of commands.

The check and the commands run fine (I use the same ones for an on_load event). but I have no idea how to run the check when the data changes in the form.

any direction much appreciated.

running access2007 on a 2003 DB with OS Xp.
Mar 2 '09 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,619
@Chinde
You can use the Dirty property to determine whether the Current Record has been modified since it was last saved. The following code will check and see if the Form has been 'Dirtied'. If it is Dirty, the code will then check and see if the Value 99999 exists in the [txtTest] Field. If the Value in this Field is 99999, then a specific set of Command are Run, if not, then the Original Value of the Field is restored. Does this Help you?
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then
  2.   If Me![txtTest] = 99999 Then
  3.     'Run a set of Commands
  4.   Else      'Restore Old Value
  5.     Me![txtTest] = Me![txtTest].OldValue
  6.   End If
  7. End If
Mar 2 '09 #2

P: 52
This is useful but it is not quite what I want. I've just re-read my original post and have notice the obvious mistake, I want the check to fire when the record in the form changes I.e. when the record in the form moves from record 1 to record 2 or whatever.
Mar 3 '09 #3

FishVal
Expert 2.5K+
P: 2,653
Hi, Chinde.

It is "Current" event which fires whenever form is pointed to a record.

Regards,
Fish.
Mar 3 '09 #4

P: 52
I would never have found that without your help. Thank you all is good and working in the world.
Mar 3 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.