P
Paul Martin
Hi All
I would like to clear textboxes on a MultiPage control. The user
chooses to clear textboxes on CURRENT page or ALL pages. My code is
below.
The problem is that Current works, but All doesn't. frmStart (the
whole form) does not pass, and I get a data mismatch error. If I
change the data type in ClearInputs from MSForms.Control to Variant,
it will work, but this seems sloppy to me - I'd like to know the
actual data type to use. I also tried using Control as the data type,
but got same error. Any suggestions?
Thanks in advance
Paul Martin
Melbourne, Australia
________________________________________
Private Sub cmdAll_Click()
' THIS FAILS - frmStart does not pass to ClearInputs
ClearInputs frmStart ' clear all textboxes on form
End Sub
________________________________________
Private Sub cmdCurrent_Click()
' THIS WORKS
Dim i as Integer
With frmStart.mpgInputs
i = .Value ' get current page of MultiPage
ClearInputs .Pages(i) ' clear textboxes on current page
End With
End Sub
________________________________________
Private Sub ClearInputs(ByRef ctlParentA As MSForms.Control)
Dim ctl As MSForms.Control
For Each ctl In ctlParentA.Controls
If TypeOf ctl Is MSForms.TextBox Then
ctl.Value = ""
End If
Next ctl
End Sub
________________________________________
I would like to clear textboxes on a MultiPage control. The user
chooses to clear textboxes on CURRENT page or ALL pages. My code is
below.
The problem is that Current works, but All doesn't. frmStart (the
whole form) does not pass, and I get a data mismatch error. If I
change the data type in ClearInputs from MSForms.Control to Variant,
it will work, but this seems sloppy to me - I'd like to know the
actual data type to use. I also tried using Control as the data type,
but got same error. Any suggestions?
Thanks in advance
Paul Martin
Melbourne, Australia
________________________________________
Private Sub cmdAll_Click()
' THIS FAILS - frmStart does not pass to ClearInputs
ClearInputs frmStart ' clear all textboxes on form
End Sub
________________________________________
Private Sub cmdCurrent_Click()
' THIS WORKS
Dim i as Integer
With frmStart.mpgInputs
i = .Value ' get current page of MultiPage
ClearInputs .Pages(i) ' clear textboxes on current page
End With
End Sub
________________________________________
Private Sub ClearInputs(ByRef ctlParentA As MSForms.Control)
Dim ctl As MSForms.Control
For Each ctl In ctlParentA.Controls
If TypeOf ctl Is MSForms.TextBox Then
ctl.Value = ""
End If
Next ctl
End Sub
________________________________________