Display query results in datasheet subform

J

JoeA2006

I need to allow users to drill down to records based on 3 criteria. Location,
Date and Transaction category. I have set up three combo boxes and a
parameter query against a query based on the value of the three combo boxes.
The query selects the correct records, however I need to display the
resulting records on the form(subform) in datasheet view. I have a command
button to run the query once the combo box selections are made but the
results are displayed in a separate data sheet view but not on the form. I
also need for the user to add, edit records once they have drilled down to
the correct date location and category. Thanks
 
R

Rick Brandt

JoeA2006 said:
I need to allow users to drill down to records based on 3 criteria.
Location, Date and Transaction category. I have set up three combo
boxes and a parameter query against a query based on the value of the
three combo boxes. The query selects the correct records, however I
need to display the resulting records on the form(subform) in
datasheet view. I have a command button to run the query once the
combo box selections are made but the results are displayed in a
separate data sheet view but not on the form. I also need for the
user to add, edit records once they have drilled down to the correct
date location and category. Thanks

Make your form a continuous form bound to the query in question and put your
ComboBoxes in the header. You can design a continuous form so it looks just
like a datasheet.
 
D

Duane Hookom

All you should need to do is set the SourceObject of the subform control to
your query name
Dim strYourQuery
strYourQuery = "qselYourQuery"
Me.subformctrl.SourceObject = "Query." & strYourQuery
 
J

JoeA2006

Instead of using a subform, I created a continuous form wth Combo boxes in
the header. I used the expression Forms!Form1.Combo0.Value for each
criteria in the query designer. The query does select the correct records
based on the criteria selected from the combo boxes, however the results
still show up in a separate datasheet view and not the form. How can I get
the results to show up on the form?
 
R

Rick Brandt

JoeA2006 said:
Instead of using a subform, I created a continuous form wth Combo
boxes in the header. I used the expression Forms!Form1.Combo0.Value
for each criteria in the query designer. The query does select the
correct records based on the criteria selected from the combo boxes,
however the results still show up in a separate datasheet view and
not the form. How can I get the results to show up on the form?

If a separate datasheet is being displayed it's because your code is asking it
to. All you need to do is issue a Requery command on the form and bind the form
to the query. There is no need to run or "open" the query.
 
J

JoeA2006

Thanks.

Rick Brandt said:
If a separate datasheet is being displayed it's because your code is asking it
to. All you need to do is issue a Requery command on the form and bind the form
to the query. There is no need to run or "open" the query.
 
J

JoeA2006

The combo boxes with the continous form and using requery works fine for
retrieving the records that meet the criteria. I can retrieve and edit these
records. Now I would like to add records based on the criteria selected from
the combo boxes. The user may need to enter multiple records for a given
Location, date and category. The Location date and category for the new entry
gets saved for the first one, but not for additional entries entered into the
text boxes of the continous form. I would like to avoid making the user re
enter location, date ,and category, info for each entry.
 

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