I have 3 subforms in my switchboard form, that are all visible/invisible based on whether or not there are specific matching records in a specific table.
I import data into a table (in which all data is deleted first) via a command button.
The code in the command button is this:
rs0.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Desktop') AND ((MainDB.[Computer 2 Type])='Desktop'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs0.RecordCount = 0 Then
Me.DoubledDesktops.Visible = False
Else
Me.DoubledDesktops.Visible = True
End If
rs2.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Laptop') AND ((MainDB.[Computer 2 Type])='Laptop'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs2.RecordCount = 0 Then
Me.Doubledlaptops.Visible = False
Else
Me.Doubledlaptops.Visible = True
End If
rs.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Laptop') AND ((MainDB.[Computer 1 O/S])='N/A'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then
Me.NolaptopOS.Visible = False
Else
Me.NolaptopOS.Visible = True
End If
DoCmd.SetWarnings True
Me.Refresh
Here's the problem: if I import a different data group where the record(s) match, say, ((MainDB.[Computer 1 Type])='Desktop') AND ((MainDB.[Computer 2 Type])='Desktop') , then the subform for that specific set of records DOESN'T appear unless I right-click & go into design.
The other problem is, that when I do this the OTHER 2 subforms show up, even though there's no records for them.
Please help.
I import data into a table (in which all data is deleted first) via a command button.
The code in the command button is this:
rs0.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Desktop') AND ((MainDB.[Computer 2 Type])='Desktop'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs0.RecordCount = 0 Then
Me.DoubledDesktops.Visible = False
Else
Me.DoubledDesktops.Visible = True
End If
rs2.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Laptop') AND ((MainDB.[Computer 2 Type])='Laptop'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs2.RecordCount = 0 Then
Me.Doubledlaptops.Visible = False
Else
Me.Doubledlaptops.Visible = True
End If
rs.Open "SELECT Name FROM MainDB WHERE (((MainDB.[Final Location]) Like '* MTV * ') AND ((MainDB.[Computer 1 Type])='Laptop') AND ((MainDB.[Computer 1 O/S])='N/A'));", _
CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rs.RecordCount = 0 Then
Me.NolaptopOS.Visible = False
Else
Me.NolaptopOS.Visible = True
End If
DoCmd.SetWarnings True
Me.Refresh
Here's the problem: if I import a different data group where the record(s) match, say, ((MainDB.[Computer 1 Type])='Desktop') AND ((MainDB.[Computer 2 Type])='Desktop') , then the subform for that specific set of records DOESN'T appear unless I right-click & go into design.
The other problem is, that when I do this the OTHER 2 subforms show up, even though there's no records for them.
Please help.