Button to open Subform (1 Viewer)

Fozi

Registered User.
Local time
Today, 15:19
Joined
Feb 28, 2006
Messages
137
I have a form on my system. I know how to include a subform on this and I also know how to use a button to open a form. What I want to know is how do you go about using a button to open a subform.

Previous attempts to do this do not insert the common data to the subform control and and such after data entry the data is un-associated.

All help greatly appreciated.

Thanks
Frank
 

SOS

Registered Lunatic
Local time
Today, 08:19
Joined
Aug 27, 2008
Messages
3,517
I'm confused a bit. You don't "open" a subform. A subform is a form that exists on the main form but with child records.

Previous attempts to do this do not insert the common data to the subform control and and such after data entry the data is un-associated.
That would be due to the links not being set properly or your subform using the wrong recordsource. Many people make the mistake of putting the same recordsource of their main form on a subform and then linking them and it doesn't work right because that's not how subforms are intended to work. They use DIFFERENT tables than the main form.

Does that help at all? Can you clarify some more of what you are actually doing (real life examples of the data involved, tables, etc.)?
 

Scooterbug

Registered User.
Local time
Today, 11:19
Joined
Mar 27, 2009
Messages
853
You should not need a button to "open" a subform. The subform should be linked to the form via a primary key/foreign key relationship.

What is the parent/child relationship for the form and subform?
 

Fozi

Registered User.
Local time
Today, 15:19
Joined
Feb 28, 2006
Messages
137
I'm confused a bit. You don't "open" a subform. A subform is a form that exists on the main form but with child records.


That would be due to the links not being set properly or your subform using the wrong recordsource. Many people make the mistake of putting the same recordsource of their main form on a subform and then linking them and it doesn't work right because that's not how subforms are intended to work. They use DIFFERENT tables than the main form.

Does that help at all? Can you clarify some more of what you are actually doing (real life examples of the data involved, tables, etc.)?

Sorry for the confusion. The parent form contains Project Details. What I want is a subform that captures ongoing corresspondence. I know this is pretty straightforward by inserting the subform within the Parent form and linking by Project reference. However to save space on the form I wondered if I could launch the subform by virtue of a command button. So on the parent for the user clicks the button which opens a form to capture corresspondence, with all entries linked by project ref.

Thanks
Frank
 

SOS

Registered Lunatic
Local time
Today, 08:19
Joined
Aug 27, 2008
Messages
3,517
So, just a point of reference then...you don't actually want a subform as normally defined. You want a popup form to add data to a child table of a parent.

So, you can do this:

You can open the form with OpenArgs in the open command and use a FIND to find if a record exists. If not, it can go to a new record. I'm not able to work out the details at the moment.
 

Users who are viewing this thread

Top Bottom