On Change Sample Code

  • Thread starter Thread starter Gary Nelson
  • Start date Start date
G

Gary Nelson

In Access2000, I have a field that allows the user to change a date and
another field that has a drop down of reasons the date is going to be
changed. Once the date is changed, I would like the focus to be changed to
the "reason" drop down field, and not allow the user to exit the form until
a reason is selected. Can anyone offer code choices?

Thanks in adavnce for the help.
 
If you set the controls TAB order properly, the next field the cursor
moves to after entering the date will be the reason combo.

To prevent the form from closing without the changes, you need to add
some code to the Forms BeforeUpdate event that checks to see whether
the combo box has a value. If not, cancel the Before Update and move
the cursor to the combo box.

The code for setting the focus on a control is: me.cboReason.setfocus


--
HTH

Dale Fye


In Access2000, I have a field that allows the user to change a date
and
another field that has a drop down of reasons the date is going to be
changed. Once the date is changed, I would like the focus to be
changed to
the "reason" drop down field, and not allow the user to exit the form
until
a reason is selected. Can anyone offer code choices?

Thanks in adavnce for the help.
 
Back
Top