If any of these 10 combo boxes Is Null, I would like to hide a tab
control on the form.
With the function I wrote for this, the tab control stays visible
regardless. Also, every time the code fires, the tab control flickers
for about 10 seconds.
This is what I have:
Private Sub ShowHideTab()
Dim Ctl As Control
On Error Resume Next
If Ctl.Tag = "start" Then
For Each Ctl In Me.Controls
If Ctl.Value = Null Then
Me.TabCtl166.Visible = False
Else
Me.TabCtl166.Visible = True
End If
Next Ctl
End If
Any suggestions?
Private Sub ShowHideTab()
Dim Ctl As Control
Dim intValue As Int
intValue = 1
For Each Ctl In Me.Controls
If Ctl.ControlType = acComboBox And Ctl.Tag = "start" And _
Ctl.Value Is Null Then intValue = 0
Next Ctl
Me.TabCtl166.Visible = intValue
End Sub
--
Ken Snell
http://www.accessmvp.com/KDSnell/
"Kurt" <heisl...@gmail.com> wrote in message
news:f54d6f73-09d5-4d0f...@j35g2000prb.googlegroups.com...
However, when the routine is called (either from the OnCurrent event
or from an AfterUpdate event of one of the combo boxes) I get this
error:
"Object doesn't support this property or method."
Debug points to the If Ctl.ControlType ... line.
Any ideas?
On Mar 11, 10:33 pm, "Ken Snell" <kthsneisll...@ncoomcastt.renaetl>
wrote:
> May I suggest this as an alternative? NOTE: I'm writing this using your
> generic approach instead of using hard-coded names for the combo box
> controls (note: using hard-coded names will make the code run much faster).
>
> Private Sub ShowHideTab()
> Dim Ctl As Control
> Dim intValue As Int
>
> intValue = 1
>
> For Each Ctl In Me.Controls
> If Ctl.ControlType = acComboBox And Ctl.Tag = "start" And _
> Ctl.Value Is Null Then intValue = 0
> Next Ctl
>
> Me.TabCtl166.Visible = intValue
> End Sub
>
> --
>
> Ken Snellhttp://www.accessmvp.com/KDSnell/
>
> "Kurt" <heislerk...@gmail.com> wrote in message
Private Sub ShowHideTab()
Dim Ctl As Control
Dim intValue As Int
intValue = 1
For Each Ctl In Me.Controls
If Ctl.ControlType = acComboBox And Ctl.Tag = "start" Then
If Ctl.Value Is Null Then intValue = 0
End If
Next Ctl
Me.TabCtl166.Visible = intValue
End Sub
--
Ken Snell
http://www.accessmvp.com/KDSnell/
"Kurt" <heisl...@gmail.com> wrote in message
news:1f18ca0d-b158-4ad4...@a11g2000pri.googlegroups.com...
Private Sub ShowHideTab()
Dim Ctl As Control
Dim intValue As Int
intValue = 1
For Each Ctl In Me.Controls
If Ctl.ControlType = acComboBox And Ctl.Tag = "start" Then
If Ctl.Value Is Null Then intValue = 0
End If
If intValue = 0 Then Exit For
Next Ctl
Me.TabCtl166.Visible = intValue
End Sub
--
Ken Snell
http://www.accessmvp.com/KDSnell/
"Ken Snell" <kthsne...@ncoomcastt.renaetl> wrote in message
news:ilmif5$l9p$1...@speranza.aioe.org...