subforms

G

Guest

I have a form with a subform. The the control source for the main form is a
table. The control source for the subform is a parameter query. The main
form shows a single record that consists of a date and some other data.
There are several records entered each day and I want to run a total for each
day and display them in the subform. I've done this before by using the
master and child fields but doesn't work. When I start the main form, I get a
popup asking for the date which is the parameter or the query for the
subform. I don't understand why this parameter query is asking for the
parameter when it should be getting the parameter from the main form.

Can you please clue me in how I can fix this problem?

Thanks,
Mike
 
A

Allen Browne

It might be a timing issue. Access loads the form before the subform, so if
the subform's query refers to:
[Forms].[YourMainForm].[YourDate]
and the main form is not yet loaded, it could ask you to supply the value.

Could you add the date field to the LinkMasterFields/LinkChildFields of the
subform control? For example, if these properties are currently set like
this:
LinkMasterFields InvoiceID
LinkChildFields InvoiceID
you add the names of the date fields so you get something like this:
LinkMasterFields InvoiceID; InvoiceDate
LinkChildFields InvoiceID; PaymentDate
 
J

Joe

Mike,

Evidently the Date field is not in the recordset for the subform.

Since you are using a query, add it to the query grid.

HTH,

Joe
 
G

Guest

got that...the query works properly by itself as does the subform when
executed by itself. In other words, the query prompts for the parameter, I
provide it and the query returns the proper result. Same behavior when I
execute the subform. This subform appears in the footer of the master form.
The Link Child field is Yr and the Link Master Field is set to Year. When I
execute the Master form, I get 2 prompts to enter the year parameter. I
enter the 2006 in the year parameter for both prompts and the form opens
properly. So, the subform isn't filling the year parameter from the master
form using the child and master links.
 
G

Guest

thanks for your reply...i provided feedback as a reply to Joe's suggestion.

Allen Browne said:
It might be a timing issue. Access loads the form before the subform, so if
the subform's query refers to:
[Forms].[YourMainForm].[YourDate]
and the main form is not yet loaded, it could ask you to supply the value.

Could you add the date field to the LinkMasterFields/LinkChildFields of the
subform control? For example, if these properties are currently set like
this:
LinkMasterFields InvoiceID
LinkChildFields InvoiceID
you add the names of the date fields so you get something like this:
LinkMasterFields InvoiceID; InvoiceDate
LinkChildFields InvoiceID; PaymentDate

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mike said:
I have a form with a subform. The the control source for the main form is
a
table. The control source for the subform is a parameter query. The
main
form shows a single record that consists of a date and some other data.
There are several records entered each day and I want to run a total for
each
day and display them in the subform. I've done this before by using the
master and child fields but doesn't work. When I start the main form, I
get a
popup asking for the date which is the parameter or the query for the
subform. I don't understand why this parameter query is asking for the
parameter when it should be getting the parameter from the main form.

Can you please clue me in how I can fix this problem?

Thanks,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top