chainging a subform

Nirious

Registered User.
Local time
Today, 15:32
Joined
Jul 31, 2004
Messages
106
Hi,

I have a form that has one subform, but according to a field of the current record( in the table that is linked to the mainform), the subform should contain FormA or in the other case FormB.

How do I do this?
 
Nirious,

Look at the Master-Child relationships. They will keep your forms in synch.

Wayne
 
Ok,

But can I just change my objectsource like that when FormA is the current subform? I mean like :

objectsource = "myFormB"
Linkchildfields = "myfieldfromB"
linkmasterfields = "myfieldfromMainForm"

And than it will be replaced and shown automatically?
 
Nirious,

I need to see what you're talking about. Can you post a sample?

Wayne
 
I have made a little example of what I currently have and what I'm looking for.

example.mdb


Currenly no matter what the code is, subformA will always be shown. That should change. Can you help me?
 
Last edited:
Nirious,

Get your main form in design view. Choose the Subform control and put
a new subform right over the top of "SubTest". Tell the wizard to put
FormB there.

You now have both subforms on top of each other.

In the FormOpen event put:

Me.SubTest.Visible = True
Me.FormB.Visible = False

In the AfterUpdate of your "WhatToShow" control:

Code:
  If Me.WhatToShow = 1 Then
     Me.SubTest.Visible = True
     Me.FormB.Visible = False
  Else
     Me.SubTest.Visible = False
     Me.FormB.Visible = True
  End If

Wayne
 
G’day all.

Really don’t remember why this A97 demo was written. :o
Might have been to save screen real estate for a palm. Don’t know, was never told.

No linking but that should be easy.

Hope it helps.

Regards,
Chris.
 

Attachments

Users who are viewing this thread

Back
Top Bottom