multiple forms on tab control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am working on a project. I put a tab control on a form and put 2
subforms (Pretest and posttest form) on a page of the tab control. If user
enters PretestID on the mainform, I want Pretest subform to display, vise
versa.
Here is my code:
Set x = Forms!frmMain!frmPre.Form
Set y = Forms!frmMain!frmPost.Form
Select Case ID
Case "PretestID",
x.visible = True
y.visible = False
Case "PosttestID",
x.visible = False
y.visible = True
But for some reason both( pre,post) form doesn't pop up when I entered
correct ID.
Please helpme!!!
 
Hi, I am working on a project. I put a tab control on a form and put 2
subforms (Pretest and posttest form) on a page of the tab control. If user
enters PretestID on the mainform, I want Pretest subform to display, vise
versa.
Here is my code:
Set x = Forms!frmMain!frmPre.Form
Set y = Forms!frmMain!frmPost.Form
Select Case ID
Case "PretestID",
x.visible = True
y.visible = False
Case "PosttestID",
x.visible = False
y.visible = True
But for some reason both( pre,post) form doesn't pop up when I entered
correct ID.
Please helpme!!!

What event contains this code? It won't work as you desire, in any
case! The Set commands are not going to give you the Subform object
you want. Also, are you having the user enter the *text string*
PretestID in some control? Which control? ID, I'm guessing?

I'd suggest a different approach. Put *ONE* Subform control on the tab
control (or just on the form, if you have room; the tab control is
irrelevant to the situation). In the AfterUpdate event of the control
containing ID put code like:

Select Case ID
Case "PretestID"
Me!subMySubform.SourceObject = "frmPre"
Case "PosttestID"
Me!subMySubform.SourceObject = "frmPost"
Case Else
Me!subMySubform.SourceObject = Null
End Select

You'll want to put the same code in the Form's Current event to
display the desired subform when the user moves from record to record.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
John, I forgot to ask in my previous email. Could you recommend some access
programming books for me to read?

thanks again
Eva
 
Back
Top