Query data into report

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

Guest

I finally figured out how to create a combobox look up for a query. That
works great. My problem is when I try to have that queried data show up on a
report I get the enter parameter box instead of it using the queried data.
Any thoughts??

Thanks
 
Dear Mark:

A limitation is that the form you reference in the query must be open when
the query is run. Is this the source of your problem?

Tom Ellison
 
The form that I am using is one that only has one combobox and two command
button controls. One command button is to cancel the query and the other one
initiates the query and brings up the appropriate data. This command button
also closes that form when the query results are shown. I tried removing the
close form part and it still would not bring the info into the report. The
query criteria points to this form and combobox for its information.

When I click on the command button that activates the query the information
displays correct data. When I try to get that information into the report
that's when I get the parameter box. Even with that query information active.

I set the procedure up following the guidelines here
http://www.fontstuff.com/access/acctut08.htm. Hopefully I provided enough
information.

Thanks
 
Dear Mark:

I don't know if I'm on the trail of the problem or not. All I can do is
try.

Now, this form that "initiates the query". Is it open when you run the
report? One good way to guarantee this is to have the report run by a
command button on this form. How are you initiating the report? Is this
form open when the report is run yet malfunctions?

Tom Ellison
 
Hi Tom, thanks for your patience

I am trying to work this out in a test db. I have a form called main1.
When this form is opened it has the two command buttons I mentioned earlier.
When I select a name from the combobox the form main1 closes and the query is
run. The associated data is brought up in datasheet view. The records that
it shows are correct. With this datasheet open I then open the report called
main that has the record source set set to namequery (this is the query that
form main1 initiates). When this report opens it has the parameter entry box
come up instead of using the already open query datasheet.

I'm thinking I need to have a sequence of events that when I open the report
it first opens form main1. the user then selects from the combobox. Once a
selection is made then namequery is run and that data is used in report main.

Thanks
Mark
 
Hi Tom, I finally figured it out. I had to add a couple lines to the form
main1 command button. That button is now configured as follows:
Private Sub cmdok_Click()
DoCmd.OpenReport "main", acViewPreview
DoCmd.OpenQuery "Namequery", acViewNormal, acEdit
DoCmd.Close acForm, "main1"
DoCmd.Close acQuery, "Namequery"
End Sub

It seems to be working. Now I will try and apply it to the project I am
working on.

Thanks again for your help.
 
Back
Top