Update subform with results of query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that runs off the account number entered in a form field. I
need the results of this query to show up in the subform on this form. The
subform is an entry form for entering account comments. The subform adds the
date to the record and allows the user to put in comments for that account. I
only want one account at a time to show in the subform.
 
I have a query that runs off the account number entered in a form field. I
need the results of this query to show up in the subform on this form. The
subform is an entry form for entering account comments. The subform adds the
date to the record and allows the user to put in comments for that account. I
only want one account at a time to show in the subform.

The simplest way to do this is to get rid of this unnecessary Query,
and simply make the Account Number the master and child link field of
the Subform. This is how subforms are designed to work!

John W. Vinson[MVP]
 
Haha... I guess that shows my understanding of subforms...

Ok, I changed the record source of the subform to the account number field
on the main form, but now Access says it can't find the table or query so I'm
assuming that I wasn't supposed to change the record source. Does the record
source need to be the table the data is coming from, and what property do I
change to link the subform's output to the account number on the main form?
 
Haha... I guess that shows my understanding of subforms...

Ok, I changed the record source of the subform to the account number field
on the main form, but now Access says it can't find the table or query so I'm
assuming that I wasn't supposed to change the record source. Does the record
source need to be the table the data is coming from, and what property do I
change to link the subform's output to the account number on the main form?

The Recordsource of any form (mainform or subform) is the Table or
Query containing the data which is to be displayed on that form. A
recordsource is NOT a field!

If you view the Properties of the Subform Control on the main form -
the box containing the subform, not the form itself - you will see two
properties named "Master Link Field" and "Child Link Field". These
provide the link. The Master Link Field should contain the name of the
field in the main form's query which identifies the records which
should be selected for display on the subform; the Child Link Field
should be the name of the corresponding field in the subform's table
or query. These would both be AccountID in your case.

John W. Vinson[MVP]
 
Ahhhhh! That's what I wasn't seeing! I'm at home now but I'll try that at
work tomorrow. That sounds like exactly what I was looking for and couldn't
find to save my life. Thanks!
 
Back
Top