Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms visible properties problem

Status
Not open for further replies.

drhenry

Programmer
May 9, 2001
30
US
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.
 
Have you tried setting visible to false for the sub forms not needed?
 
Hi djj55.
Yes, in fact I tried setting visible to false in the main form load, & doing a refresh.
 
I thought DoEvents was strictly related to yielding to system processes?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top