Changing the subform at run-time

PedroSantos

New member
Local time
Today, 01:27
Joined
Feb 11, 2002
Messages
8
Hy.
I'm a newbie to MS Access, and I would like to know how can I change a form's subform dynamicly, at run-time.
For example, the main form is "Persons". If the current record or person is male, I want the subform to be "MyCars" with all cars' properties. If the person is female, I want the subform to automaticly change to "MyDolls", with all the properties for the dolls.
Can I do this? How? Please, be objective in your response, because as I said, I'm a newbie at access... unfortunately, I'm needing this for school...
By the way, could you please tell me some good sites about access?
Thanks you.
 
In the forms On Current event code like this should work:

If Me![GenderField] = "Male" Then
Me.SubformName.SourceObject = "AQuery"
ElseIf Me![GenderField = "Female" Then
Me.SubformName.SourceObject = "TheOtherQuery"
End if

Be sure and change the field names to those you actually have.
 

Users who are viewing this thread

Back
Top Bottom