Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multipage focus problem

Status
Not open for further replies.

davefish

Technical User
Jul 26, 2002
169
GB
I wonder if anyone can help. I have a user form with two pages and a number of controls including text boxes and check boxes. I'm trying to give focus to the first page (page0) on intialization by using the procedure

Sub UserForm_Initialize()
MyMulti.Value = 0
End Sub

This produces a run error 242 stating object is required. If I then try to give focus to a ComboBox on the first page using

Ip_Cmb_Volt.SetFocus

I get another runtime error 2110 stating the control is invisible or not enabled. I've tried changing the properties to no avail. Can anyone help?

DaveFish
 
You could try something like this:
[blue]
Code:
Private Sub UserForm_Initialize()
  MultiPage1.Pages(1).Visible = False
  MultiPage1.Pages(1).Visible = True
  Ip_Cmb_Volt.SetFocus
End Sub
[/color]

 
Hi Zathras,

Many thanks this worked well.


All the best

DaveFish
 
DaveFish, there is an easier way. I should have found it last week:
[blue]
Code:
Private Sub UserForm_Initialize()
  MultiPage1.Value = 0
  Ip_Cmb_Volt.SetFocus
End Sub
[/color]
 
Hi Zathras,

Tried this and it works equally as well with less code.

Many Thanks

DaveFish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top