Form/Subform menu

J

Joseph Udell

I'm trying to create a form based menu. A user is given 5 options on the
main form. When the user clicks on an option I want the subform to change.
I'm not very fluent in VB so i'm not sure of where to proceed.

Thank you for your assistance,
J Udell
 
J

June Macleod

To change the sourceobject of a subform use:

Forms![mainformName]![SubFormControlName].SourceObject = "Detail2"
Forms![mainformName]![SubFormControlName].Form.Requery

You could put this into a Case statement to pick up the appropriate name


Private Sub Frame0_Click()
On Error GoTo err_Frame0
Dim theSubFormName As String
Select Case Frame0
Case 1
theSubFormName = "Monday"
Case 2
theSubFormName = "Tuesday"
Case 3
theSubFormName = "Wednesday"
Case 4
theSubFormName = "Thursday"
Case 5
theSubFormName = "Friday"
Case Else
theSubFormName = "Weekend"
End Select


Forms![mainformName]![SubFormControlName].SourceObject = theSubFormName
Forms![mainformName]![SubFormControlName].Form.Requery

exit_Frame0:
Exit Sub
err_Frame0:
MsgBox Err.Description
Resume exit_Frame0
End Sub


Hope this helps

June Macleod
 
A

aurora

If I understand you correctly, you are creating a menu and
when someone clicks on the button, a form or report will
appear. I don't believe that is what you call a subform.

If that is what you want to do - here is what I did.
Create a form in design view. Make sure the wizard button
is selected. Select the control button from the menu and
click where you want it on the form. This will bring up
the contol wizard for most of your basic needs such as
opening a form or report, navagaing, closing, saving etc.
If you want something more complicated than that, create a
macro that does what you want. Then when you put the
botton on your form, close the wizard and pull up the
properties of the button. Go down to where it says "on
click", click the down arrow and choose the macro you
wrote. Try this. It worked very nicely for me. I just
did this.

Aurora
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top