deepheat101
Board Regular
- Joined
- Jul 26, 2006
- Messages
- 138
Greetings (again)
On my MultiPage UserForm that has potentially 20 pages with each page containing three TextBox. I am attempting to perform the following data validation - if the page is visible then none of the three TextBoxes that exist on that page can be blank. If a TextBox is blank SetFocus to it.
The naming convention that I have used for the TextBoxes is as follows...
The code marked with "<<<<<<<<<<" does not get past the VBA syntax checker Interestingly, the Case statements pass the syntax checker but fail at run time. What is the correct code for these lines?
Many Thanks
dp
On my MultiPage UserForm that has potentially 20 pages with each page containing three TextBox. I am attempting to perform the following data validation - if the page is visible then none of the three TextBoxes that exist on that page can be blank. If a TextBox is blank SetFocus to it.
The naming convention that I have used for the TextBoxes is as follows...
Code:
Page1 Page2 Page3 Page4 etc.....
txtBox11 txtBox12 txtBox13 txtBox14
txtBox21 txtBox22 txtBox23 txtBox24
txtBox31 txtBox32 txtBox33 txtBox34
Code:
For PageNumber = 1 To 20
If frmMain.MultiPage1.Pages(PageNumber).Visible = True Then
Select Case ""
Case .Pages(PageNumber).txtBox1 & PageNumber
frmMain.txtBox1 & PageNumber.SetFocus '<<<<<<<<<<
Case .Pages(PageNumber).txtBox2 & PageNumber
frmMain.txtBox2 & PageNumber.SetFocus '<<<<<<<<<<
Case .Pages(PageNumber).txtBox3 & PageNumber
frmMain.txtBox3 & PageNumber.SetFocus '<<<<<<<<<<
End Select
End If
Next
The code marked with "<<<<<<<<<<" does not get past the VBA syntax checker Interestingly, the Case statements pass the syntax checker but fail at run time. What is the correct code for these lines?
Many Thanks
dp