G
GMartin via AccessMonster.com
In the following code below i have a series of tabs. I want to hide all tabs
when form is opened unless field is greater than a certain # then I need for
the appropriate tabs to show. This works fine except when I scroll through
and reach a record that has staff count at 0 then i get an error. I can
cancel debug and the remaining records work and the tabs will hide and be
visible as the numbers change.
Me.Inmate_Victim_1.Visible = _
(Me.NoVictims > 0)
Me.Inmate_Victim_2.Visible = _
(Me.NoVictims > 1)
Me.Inmate_Victim_3.Visible = _
(Me.NoVictims > 2)
Me.Inmate_Victim_4.Visible = _
(Me.NoVictims > 3)
Me.Inmate_Victim_5.Visible = _
(Me.NoVictims > 4)
Me.Inmate_Victim_6.Visible = _
(Me.NoVictims > 5)
Me.Inmate_Aggressor_1.Visible = _
(Me.NoAggressors > 0 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_2.Visible = _
(Me.NoAggressors > 1 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_3.Visible = _
(Me.NoAggressors > 2 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_4.Visible = _
(Me.NoAggressors > 3 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_5.Visible = _
(Me.NoAggressors > 4 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_6.Visible = _
(Me.NoAggressors > 5 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Staff_Aggressor_1.Visible = _
(Me.NoAggressors > 0 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_2.Visible = _
(Me.NoAggressors > 1 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_3.Visible = _
(Me.NoAggressors > 2 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_4.Visible = _
(Me.NoAggressors > 3 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_5.Visible = _
(Me.NoAggressors > 4 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_6.Visible = _
(Me.NoAggressors > 5 And Me.IncidentType Like "Staff*")
when form is opened unless field is greater than a certain # then I need for
the appropriate tabs to show. This works fine except when I scroll through
and reach a record that has staff count at 0 then i get an error. I can
cancel debug and the remaining records work and the tabs will hide and be
visible as the numbers change.
Me.Inmate_Victim_1.Visible = _
(Me.NoVictims > 0)
Me.Inmate_Victim_2.Visible = _
(Me.NoVictims > 1)
Me.Inmate_Victim_3.Visible = _
(Me.NoVictims > 2)
Me.Inmate_Victim_4.Visible = _
(Me.NoVictims > 3)
Me.Inmate_Victim_5.Visible = _
(Me.NoVictims > 4)
Me.Inmate_Victim_6.Visible = _
(Me.NoVictims > 5)
Me.Inmate_Aggressor_1.Visible = _
(Me.NoAggressors > 0 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_2.Visible = _
(Me.NoAggressors > 1 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_3.Visible = _
(Me.NoAggressors > 2 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_4.Visible = _
(Me.NoAggressors > 3 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_5.Visible = _
(Me.NoAggressors > 4 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Inmate_Aggressor_6.Visible = _
(Me.NoAggressors > 5 And Me.IncidentType Like
"*Inmate/Inmate*")
Me.Staff_Aggressor_1.Visible = _
(Me.NoAggressors > 0 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_2.Visible = _
(Me.NoAggressors > 1 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_3.Visible = _
(Me.NoAggressors > 2 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_4.Visible = _
(Me.NoAggressors > 3 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_5.Visible = _
(Me.NoAggressors > 4 And Me.IncidentType Like "Staff*")
Me.Staff_Aggressor_6.Visible = _
(Me.NoAggressors > 5 And Me.IncidentType Like "Staff*")