Filter records by date in subform by date entered in mainform.

K

Kevin D

Hello, I've spent 3 days trying to understand what I'm doing
wrong.....Here is the summary of my problem.

I have a form named 'frm_EfficiencyStats' and a subform within the
form named 'qry_Total hours subform' (the subform is based on a
query). The form contains a text box (for date) which is bound to a
table 'tbl_EfficiencyStats'.
I would like to be able to enter a date in the text box on my form,
and display the records in the subform based on the date I entered in
the text box. The subform will only pull records from my table based
on the date.
Here are the fields I am using which are essentially tied to one
another.....'DATE' and 'NAME'.

I'm not sure if a filter needs to be applied, but I thought
associating the link child and master fields in the subform would do
the trick.

I apologize for the messy explination, please let me know if you
require any further information.

Thank you for any assistance you may be able to offer.
 
J

John W. Vinson

Hello, I've spent 3 days trying to understand what I'm doing
wrong.....Here is the summary of my problem.

I have a form named 'frm_EfficiencyStats' and a subform within the
form named 'qry_Total hours subform' (the subform is based on a
query). The form contains a text box (for date) which is bound to a
table 'tbl_EfficiencyStats'.
I would like to be able to enter a date in the text box on my form,
and display the records in the subform based on the date I entered in
the text box. The subform will only pull records from my table based
on the date.
Here are the fields I am using which are essentially tied to one
another.....'DATE' and 'NAME'.

First off... *change your fieldnames*. DATE is a reserved word for the builtin
Date() function; NAME is a reserved word because *everything* - forms,
controls, fields, tables - has a Name property. Access *will* get confused
(and may have done so, causing your problem).

A control used for the purpose of *finding* or filtering records should (must,
I'd say) be Unbound. Otherwise you will overwrite whatever the field contains
in the first record, or whatever record is displayed.

You can use an unbound textbox named (say) txtDate, and set the Master Link
Field property of your subform to [txtDate]. Do use the brackets. Access won't
give you this as a choice but you can type it in. The Child Link Field should
be the name of the datefield in the subform's query, but the query should
*not* reference the form nor should it be filtered by the date value; as you
guessed, the master/child link should take care of it.

John W. Vinson [MVP]
 

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