On Change Sample Code

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.
 
D

Dale Fye

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.
 

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