Linking preview report button to field entry in form

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

Guest

I've added a "preview report" button to my form used to enter data. I would
like to have the report that shows when the button is selected refer only to
the data linked to an entry in a specific field, for example: we have ten
groups total in the tables related to the form. The field on the form used
to enter data indicates group 2 and I want the report previewed from the
button on the form to refer only to items pertaining to group 2. Is this
possible? and, if possible how do I do this?
 
hi Susan,

Susan said:
I've added a "preview report" button to my form used to enter data. I would
like to have the report that shows when the button is selected refer only to
the data linked to an entry in a specific field, for example: we have ten
groups total in the tables related to the form. The field on the form used
to enter data indicates group 2 and I want the report previewed from the
button on the form to refer only to items pertaining to group 2. Is this
possible? and, if possible how do I do this?

If the underlying query of your report has an identical datasource, then
you can use

OpenReport "YourReport", acViewPreview, , "GROUP_ID=" & Me![GROUP_ID]

depending on your field names.

mfG
--> stefan <--
 
Stefan, thank you for your answer. Here are my specifics: I am developing
this database in Access 2002. The form is based on a table and the report is
based on a query that combines the specific data in the table with linked
tables of basic name type data (like PN in the form table will link to
Pacific Northwest in another table in the query so the report has names
instead of acronyms). I'm not real familiar with visual basic so I'm using
the builder located on the "on click" line of the properties box for the view
report button. The statement you suggested is analogous to what I have:
openreport, print preview, the filter box is blank (maybe this is the
problem? i haven't written any filters), for where conditions I have
"[Reports]![Fund Transfer Narrative]![PN #]=[Forms]![Fund Transfers]![PN #]".
The query has a parameter condition to enter the PN# to return an individual
record instead of the few hunderd that are in the database. With the above
macro as the "on click" condition, I still get the parameter question - even
when I have cleared the underlying queries of all criteria. This is a
database I built for a work task of mine, and a coworker is also building an
access database for a work task...he would also like to have a report
specific to the form show with the preview report button. His
table/form/query/report relationship is the same as in my database and he had
the same results when trying the statement you suggested. What are we
missing here?
 
hi Susan,

Susan said:
"[Reports]![Fund Transfer Narrative]![PN #]=[Forms]![Fund Transfers]![PN #]".

The WhereCondition is a constraint for your data, therefore it must look
like this:
"[PN #]=[Forms]![Fund Transfers]![PN #]"
The [PN #] is the field in the RecordSource (query which returns the
data) of your report.

mfG
--> stefan <--
 
this worked great! thank you for your help. ***susan***

stefan hoffmann said:
hi Susan,

Susan said:
"[Reports]![Fund Transfer Narrative]![PN #]=[Forms]![Fund Transfers]![PN #]".

The WhereCondition is a constraint for your data, therefore it must look
like this:
"[PN #]=[Forms]![Fund Transfers]![PN #]"
The [PN #] is the field in the RecordSource (query which returns the
data) of your report.

mfG
--> stefan <--
 
Back
Top