Printing Reports

Charlie_21

New member
Local time
Today, 23:20
Joined
Nov 12, 2002
Messages
7
Hi,
Hope someone can help. Think it is a simple question. I have a very small database , where I want to be able to print individual records.
Currently using the wizards and the command button options the print option prints all the records held in one table.

How do I set it up so when I click the print command button , it will only print the record I am currently viewing ?

Any help appreciated.:confused:
 
First you need to create a query similiar to this....

SELECT *
FROM ?????
WHERE [FORMS]![Name of your Form]![Primary Key Field]=????.Primary Key Field;

Question marks being your table that the data resides in.

Next create a report using the the query listed above for the data to be viewed.

On your form create a command button.....click on Report Operations then on Preview Report. Select the report that you created.

What this will do is when you are in your form and click the command button it will create a report for the record that you are viewing in your form.

Good Luck,

Kacy
________
Toys gay
 
Last edited:
Form printing

Hi kbreiss

I have made a query as you have outlined. However when I run the query as below I get a syntax error.

SELECT *
FROM Recipes
WHERE [FORMS]![Recipes]![Primary Key Field]=Recipes.Primary Key Field;

When I amend it to remove the last .Primary key field;
as below

SELECT *
FROM Recipes
WHERE [FORMS]![Recipes]![Primary Key Field]=Recipes;

It works however I get a an input box asking for a value before the query will run.

Any ideas ??
 
The name Primary Key Field was used as an example, you have to change the name to that of your own fields
 
Hi Rich

Done that , as below

SELECT *
FROM Recipes
WHERE [FORMS]![Recipes]![Recipe ID]=Recipes.PrimaryKeyField;

Syntax is now correct, however when I run the command button on the form , linked to this query it still bring up an input box

Enter Parameter Value
Recipes.PrimaryKeyField

:confused:
 
Open the query in design mode so the grid is shown, in the criteria for Recipe ID just put [FORMS]![Recipes]![Recipe ID]
switch to SQL view to get the correct result
 
Hi Rich

Gettting closer. Now the button works without the input box. However the report hold no data , only the column headings ?

This is the SQL generated by adding what you suggested.

SELECT Recipes.RecipeID, Recipes.RecipeName, Recipes.Field3, Recipes.Field2, Recipes.Field1, Recipes.Ingredients, Recipes.NumberofServings
FROM Recipes
WHERE (((Recipes.RecipeID)=[FORMS]![Recipes]![Recipe ID]));

Thanks for your input on this.
 
If this is after you have entered a new record that the report is empty, you should save the record first
 
Hi Rich

Thanks for your support on this. I save the record, and I go to other records , then back to the one I want to print and all the data is contained on the form.

Nothing is coming out on the report , only the column headings.
 
I have a form that prints in the manner you want. (The button is command41 in the example below).
The action is attached to the click on this button
The button is on the form called "frm_enter_enquiry".


Private Sub Command41_Click()
On Error GoTo Err_Command41_Click


DoCmd.OpenReport "rpt_print_one_record", acPreview, , "ID=[forms]![frm_enter_enquiry]![ID]"


The report "rpt_print_one_record" has the record source as the table where the data is stored and the following filter (ID=[forms]![frm_enter_enquiry]![ID])
 

Users who are viewing this thread

Back
Top Bottom