SetFocus when in TabCtl

legendv

Registered User.
Local time
Today, 09:35
Joined
Mar 18, 2002
Messages
99
Need a little help here, if someone has the time. I have a form with a tabctl on it with 5 pages. On the first page (page index 0) is a checkbox. when the user clicks the checkbox and value is true I want the focus to be set to a textbox on a different page (page index 1). I tried:
chkbox OnClick event
if chkbox.value = true then
form_customer.tabctl14.page1.date.setfocus
else
othertxtbox.setfocus
endif

This doesn't work. Seems logical to me, but to no avail it doesn't. Any suggestions?
 
Try

Code:
chkbox OnClick event
if chkbox.value = true then
form_customer!page1!Controls!date.setfocus
else
othertxtbox.setfocus
endif

Glen.
 
If Me.Checkbox=True Then
Page.1.SetFocus
date.SetFocus
Else
OtherTxtBox.SetFocus
End If
Also if you have a field named date then you should change it to something else, Date is a reserved word in access.
 
naygl, and Rich,
Thanks for your help, tried both ways but neither would setfocus/go to the page.
when false, it did setfocus to other object, but the main objective was to open the other page.
Using page.1.setfocus gave me an unexpected compile error.
What am I doing wrong?
 
Thanks fellows, got it to work with your help and looking at it a little closer. I was using the page index number instead of the objects name. Sorry about that. It works now this is what worked.
Private Sub MakeAppt_Click()

If MakeAppt.Value = True Then
Form_Customer.Page28.SetFocus
DateToday.SetFocus
Else
Walk_Phone.SetFocus
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom