View Single Post
  #5 (permalink)  
Old 12-31-03, 02:46
CyberLynx CyberLynx is offline
Stuck on my opinions...
 
Join Date: Nov 2003
Posts: 1,487
I'm not sure exactly what you mean. Never the less...I have now tested the code posted and all works fine. If you find that the subforms are not coming into view (visible) that it may be possible that your positioning statements (.Left, .Top, etc.) are placing the subforms into the dark zone (so to speak) of your form. Try rem'ing out the Positioning statements.

Quote:
Is it possible to add each set visible and set invisible in each event
so command 1 would have set client visible, set employee invisible,set project invisible. ?
Now, if you mean (by your question) whether or not you can control the visible property of each subform within the OnClick event of each command button....the answer is "Yes". But this requires a lot of unnecessary code (see the example below). Each button would need to make visible its' respecitive subform and make invisible all other subforms. This could look rather cryptic should you have lets say, 15 or 20 subforms. The choice is really up to you but better coding practice would be to keep the code as short as possible thus creating a faster, smaller, maintainable, and easier to read application.

Code:
Private Sub Command1_Click()
   'Hide unwanted SubForms.
   Me.Employee.Visible = False
   Me.Project.Visible = False
   'Set SubForm position.
   Me.Client.Left = 1.25 * 1440
   Me.Client.Top = 1.5 * 1440
   Me.Client.Height = 2 * 1440
   Me.Client.Width = 3.5 * 1440    
   'Set the "Client" SubForm visible.   
   Me.Client.Visible = True
End Sub

Private Sub Command2_Click()
   'Hide unwanted SubForms.
   Me.Client.Visible = False
   Me.Project.Visible = False
   'Set SubForm position.
   Me.Employee.Left = 1.25 * 1440
   Me.Employee.Top = 1.5 * 1440
   Me.Employee.Height = 2 * 1440
   Me.Employee.Width = 3.5 * 1440 
   'Set the "Employee" SubForm visible.
   Me.Employee.Visible = True
End Sub

Private Sub Command3_Click()
   'Hide unwanted SubForms.
   Me.Client.Visible = False
   Me.Employee.Visible = False
   'Set SubForm position.
   Me.Project.Left = 1.25 * 1440
   Me.Project.Top = 1.5 * 1440
   Me.Project.Height = 2 * 1440
   Me.Project.Width = 3.5 * 1440 
   'Set the "Project" SubForm visible.
   Me.Project.Visible = True
End Sub
See what I mean....
Reply With Quote