Changing tab or OnExit in list box

C

cricket7

I have a form that I can't seem to figure out how to make the tab be
dependant on the choice that is made from a drop down list. I was
thinking
it might have to do with OnExit. But I don't know code.

Also, this database I am working in has the time in 2 different data
boxes.
So to enter 8:35 AM you have to put in the first box 08 then tab to
the 2nd
box and enter 35. Is there a way for this to automatically go to the
2nd box
without tabbing so that it is just regular data entry of 0835?

Thanks,
Pat
 
M

Mr B

Pat,

To change the tab based on the selection from a combo box you can use a
select case statement to select the approprate tab for the selection from the
combo box.

The display of a specific tab is determined using the "Tab Indes" property
of the tab control.

You would need to place code in the "After Update" event of the combo box.
This code would be something like the following:

Private Sub NameOfYourComboBox_Click()
Select Case Me.NameOfYourComboBox
Case "First Tab"
Me.TabCtl2.Pages(0).SetFocus
Case "Second Tab"
Me.TabCtl2.Pages(1).SetFocus
Case "ThirdTab"
Me.TabCtl2.Pages(2).SetFocus
'End Select
End Sub

In the code above, the term "NameOfYourComboBox" is to be replaced with the
actual name of your combo box. The string values following each "Case"
statement ("First Tab") would need to be changed to the value that the user
would select from the combo box when you want to have the first tab of the
tab contol displayed. You would also need to add a Case for each value that
could be possible from your combo box.
 
M

Mr B

As for your time entry question.

If you are going to use the two fields then you can make the following
changes to the controls on your form and get what you want.

First, make sure that your tab order is such that if your cursor in in the
first control (box) and you press the tab key your cursor is moved to the
second control (box).

Next, place an input mask on the first box. Place the following in the Input
Mask property of the control: "00" (without the quotes). This property is on
the "Data" tab of the Properties Dialog box.

Next, on the "Other" tab of the Properties Dialog box locate the "Auto Tab"
property and change its value to "Yes".

Now when you enter two number values in the first control, the cursor will
immediately move to the next control.
 

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