Change field value if record is changed.

calvinle

Registered User.
Local time
Today, 11:40
Joined
Sep 26, 2014
Messages
332
Hi,

I am having trouble figuring out how to do this:

I have form in continous form with a form header that has some field and in the form section, it has the record listed.
Whenever the data is entered in the field on the form header, there is a command button to validate the field info, then it will list that record, and a checkbox (Yes/No) field is checked for that record. Which means is valid.

Now, whenever a field of that record is changed, I want that checkbox to be false. So the user have to click on the Command Button in order to have the checkbox back to true. That being said, if the form is dirty, then the checkbox field [valid_change] will be false.

I have tried to add the function in the Before_Even of the form, then for the function:
Code:
 If Me.Dirty Then Me.valid_change = False

It doesnt work. Can anyone guide me how to detect if any of the field on the form for that selected record is changed, then set checkbox to False.

I have an idea which is on the Got Focus, set a string to capture the old value. Then on Lost Focus, capture the new value, then call a function to compare those 2 field old vs new. But if I have to do so, then I will need to add an Got Focus and Lost Focus for every field on that form which takes very long. I have about 50 fields, so 50 x 2 = 100 times??

I am sure there is a better to do it isnt it?

Thanks
 
on each controls before update event set valid_change = false
 
I guess I figure it out. I only need to send all the after update to a function using
Me.control <> Me.control.oldvalue then

In case anyone have the same issue.

Thanks
 
Hi,

I am having trouble figuring out how to do this:

I have form in continous form with a form header that has some field and in the form section, it has the record listed.
Whenever the data is entered in the field on the form header, there is a command button to validate the field info, then it will list that record, and a checkbox (Yes/No) field is checked for that record. Which means is valid.

Now, whenever a field of that record is changed, I want that checkbox to be false. So the user have to click on the Command Button in order to have the checkbox back to true. That being said, if the form is dirty, then the checkbox field [valid_change] will be false.

I have tried to add the function in the Before_Even of the form, then for the function:
Code:
 If Me.Dirty Then Me.valid_change = False

It doesnt work. Can anyone guide me how to detect if any of the field on the form for that selected record is changed, then set checkbox to False.

I have an idea which is on the Got Focus, set a string to capture the old value. Then on Lost Focus, capture the new value, then call a function to compare those 2 field old vs new. But if I have to do so, then I will need to add an Got Focus and Lost Focus for every field on that form which takes very long. I have about 50 fields, so 50 x 2 = 100 times??

I am sure there is a better to do it isnt it?

Thanks

You could should set the valid_change field to false in the "On Current" event and then in the BEFORE UPDATE event display a message telling the user that he/she needs to press a button in the header to validate.

That being said I can't think of a reason for the manual validating at all. You can simply do the checking in BEFORE UPDATE event by executing the code of the On_Click event of the button. No?

Best,
Jiri
 

Users who are viewing this thread

Back
Top Bottom