Use macro to set value of control on form

  • Thread starter Thread starter Tom K via AccessMonster.com
  • Start date Start date
T

Tom K via AccessMonster.com

I would like to set the value of a control on a form based on weather another
control is null or not. Im trying to use a before update conditional macro to
check if a control has a date, if it does then I want the value in another
control to be empty (null). Could I use the setvalue action? What condition
should I use to check to see if a control is not empty? Will setting the
control to null also change its value in the table?

Thanks,
Tom
 
Yes, SetValue action can work for this.

I'd use a Condition expression similar to this:
Len([ControlWithDateMaybe] & "") > 0
Then the SetValue would set the other control to Null.

Data in a table are changed only if a control on the form is bound to a
field in the table. Change the value of the control in this case, and the
value in the table also will change (when the form saves its data).
 
Thanks,
It works great. I also set it to be run in the other control in the after
update event to check if there was already a entry in the first control.

Thanks again

Tom
Yes, SetValue action can work for this.

I'd use a Condition expression similar to this:
Len([ControlWithDateMaybe] & "") > 0
Then the SetValue would set the other control to Null.

Data in a table are changed only if a control on the form is bound to a
field in the table. Change the value of the control in this case, and the
value in the table also will change (when the form saves its data).
I would like to set the value of a control on a form based on weather
another
[quoted text clipped - 8 lines]
Thanks,
Tom
 
Back
Top