When you run the report (from your from), your report 'Record Source' property should be a query selecting a fields in the table but where the table primary key is = to the key on the calling form.
e.g:
"Select * from mytable where pk = forms!callingform.pk"
Regards,
Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
I have been using wizards to create forms and reports. If this is a big problem / limitation please let me know.
So I create a query which includes the PK? (which happens to be a unique ID that access generated - there is no other unique data available unfortunately. All tables have this 'auto-number' type ID Prim. key field and that is the only way of relating the tables I can see)
I'm not sure how to create this query you are talking about. Help!
Hi, don't know if i can help...but here's a more novice view..
Create a query by selecting all the fields you want to appear on your report. (these fields will also be displaying your data on your form)
then simply go to reports
- 'create new'.....
- use the wizard...selecting all the fields and then simply choosing your intiial display (can play with that later!)
WHen you make this query you need to include the Primary Key of the table you have selected these fields from. This doesn't have to be actually displayed on the form itself.
If you create a button (using a wizard) on your form choose the function 'preview report'
By pressing this button..the record that you have displayed on your form should 'in theory' be displayed on your report
This worked for me..but no scenario is the same... any little niggles and let me know.
It is simpler to go to design view.
Select the table(s) you need to get the relevant fields from .....then simply choose your fields by selecting them in the boxes below
I created a query as you suggested, PK from main table and then added relevant fields from other table. Now I have a query. This query still displays all the records tho. at this point.
I go to report wizard and base it on this new query I have created. The report then also displays all the records.
Do you know of any report property settings or something that will link the report to the current form record?
Here's a different approach to use. Create your report like normal and have it include all records.
Then from your form, just open the report with a filter. Create a button on the form which your user can click to open the report. In the button click event just put this code to open the report with just the current record showing.
My PK ID is not on the form, does this matter? The problem is that ID is an auto number type that Access generated due to the fact I have no unique data. Is this an issue?
I assumed from your earlier posts that your primary key was a number. If it's a text field then you need quotes around the field. Is Company Name really your primary key?????
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.