Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / January 2006

Tip: Looking for answers? Try searching our database.

Linking form to subform by field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
floprock - 23 Jan 2006 13:23 GMT
I'm working on a budgeting database.  I have a Purchases form where purhcases
are entered.  The person will put in their clock number, purchase date,
amount, etc.  When the person puts their clock number in I want a subform to
fill up with all of the purchases related to that clock number.  So far I
have a query for the subform that calls all purchases, but I don't know how
to make the subform show only the active clock number's purchases.  What kind
of relationships are needed for this?  How would I go about wiring the
subform properly?

Thanks!
floprock
Sprinks - 23 Jan 2006 15:20 GMT
Floprock,

Ownership of child records is established by setting the subform's
LinkMasterFields and LinkChildFields properties to the name of the matching
field(s) in the main form's and subform's underlying recordsets respectively.

Sprinks

> I'm working on a budgeting database.  I have a Purchases form where purhcases
> are entered.  The person will put in their clock number, purchase date,
[quoted text clipped - 7 lines]
> Thanks!
> floprock
floprock - 23 Jan 2006 19:20 GMT
When I click on the ellipsis on either Link Child Fields or Link Master
Fields I get "Can't build a link between unbound forms."  I think I've built
my main form in the wrong way, but I can't bend my mind around why it's
wrong.  :)  It's a Purchases form to enter new purchases, and I have it based
on a query pulling data from the Purchases table.  The subform that's
currently on it is based on a different query pulling basically the same
information from the Purchases table.  Is there something wrong with basing
both forms on the same table's data?  Arg!

floprock

> Floprock,
>
[quoted text clipped - 15 lines]
> > Thanks!
> > floprock
Sprinks - 24 Jan 2006 17:41 GMT
floprock,

I've never seen this error message before.  If data is showing on the forms,
presumably they ARE bound.  Please post the RecordSource property of both the
main and subforms, and I'll see if I can help.  If they are the name of
stored queries, open each in Design view, select View, SQL, and cut and paste
the SQL of each.

Sprinks

> When I click on the ellipsis on either Link Child Fields or Link Master
> Fields I get "Can't build a link between unbound forms."  I think I've built
[quoted text clipped - 26 lines]
> > > Thanks!
> > > floprock
floprock - 25 Jan 2006 14:01 GMT
Okay, the form frmNewPurchases has a "Record Source" of "qryNewPurchases".  
The subform has a "Source Object" of "Query.qryHistPurchases".  When the form
is in Form View the form is fine for entering purchases, but the subform just
sits there statically showing the contents of the tblPurchases table.

Do I even have the tables structured correctly?  I have a table tblBuyers
for the people who are entering in their purchases, and the tblPurchases
where the purchases are stored.  Should I somehow be separating the purchases
into two tables so that the form and subform are not looking at the same
table?

floprock

> floprock,
>
[quoted text clipped - 36 lines]
> > > > Thanks!
> > > > floprock
Sprinks - 25 Jan 2006 21:08 GMT
Your subform is currently Unbound, which explains the error message you're
receiving.  Set the SourceObject property of the subform *control* to the
name of the form it represents.  Then double-click on the subform to enable
editing the subform *itself*.  

Confused?  I know I first was, but when you drag a form from the Forms
window onto a main form in Design view, the subform becomes a control in the
main form, just like a textbox or combo box control.  When you click on the
subform in design view of the main form, you are accessing this control, two
of whose properties are LinkMasterFields and LinkChildFields, along with the
SourceObject property, which tells Access which form the control is
associated with. If SourceObject is set to something other than a form name,
it is Unbound, and you cannot therefore set the linking fields.

Regarding your second question, although it's a little unusual, I don't see
anything wrong with showing additional detail records based on the same table
to which the main form is bound.

Good luck.
Sprinks

> Okay, the form frmNewPurchases has a "Record Source" of "qryNewPurchases".  
> The subform has a "Source Object" of "Query.qryHistPurchases".  When the form
[quoted text clipped - 49 lines]
> > > > > Thanks!
> > > > > floprock
floprock - 25 Jan 2006 21:37 GMT
All right!!  This crazy thing DOES work!!  Thanks a ton for all of your help!
Have a great day!

floprock

> Your subform is currently Unbound, which explains the error message you're
> receiving.  Set the SourceObject property of the subform *control* to the
[quoted text clipped - 70 lines]
> > > > > > Thanks!
> > > > > > floprock
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.