Want report to pull data based on acount # on form.

Q

QDZF

I have a form with general account info. I would like to add a command
button that when clicked would launch a report that pulls all associated
service info for the account showing on the form. I've tried building the
report through query and by linking the tables in the report wizard. By
itself, the report runs (although it shows all the service info in the file
for every account) but when I run it from the command button it comes up
blank. How do I link these? Thanks
 
M

Marshall Barton

QDZF said:
I have a form with general account info. I would like to add a command
button that when clicked would launch a report that pulls all associated
service info for the account showing on the form. I've tried building the
report through query and by linking the tables in the report wizard. By
itself, the report runs (although it shows all the service info in the file
for every account) but when I run it from the command button it comes up
blank.


Use the OpenReport method's WhereCondition argument to
filter the report's data. If that's not sufficient to get
youy going, post back with a Copy/Paste of the button's
Click event procedure.
 
Q

QDZF

Here's the expression. When I click on the command button, I get prompted to
enter a value for the ID field on the report. If I enter one, I get the
report I want. How do I link the ID field on the form and the report so the
value defaults and I am not prompted?

[Forms]![frmInventory]![tblOrigInventory_ID]=[Reports]![rptOrigSoftwareNeeds]![tblOrigInventory].[ID]

Thanks.
 
M

Marshall Barton

Get rid of the criteria in the report's record source query
and use the OpenReport method's WhereCondition argument.
It would look something like:
DoCmd.OpenReport "stDoc", , , "account=" & Me.account

I can help you with that, but I need to know the name of the
field and see the button's Click event procedure.
--
Marsh
MVP [MS Access]

Here's the expression. When I click on the command button, I get prompted to
enter a value for the ID field on the report. If I enter one, I get the
report I want. How do I link the ID field on the form and the report so the
value defaults and I am not prompted?

[Forms]![frmInventory]![tblOrigInventory_ID]=[Reports]![rptOrigSoftwareNeeds]![tblOrigInventory].[ID]


Marshall Barton said:
Use the OpenReport method's WhereCondition argument to
filter the report's data. If that's not sufficient to get
youy going, post back with a Copy/Paste of the button's
Click event procedure.
 

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