Print the current record in a report using a form

imtiazali266

Registered User.
Local time
Today, 03:14
Joined
Jan 22, 2020
Messages
11
I have one table name as table2, one form name as form1 and one report name as report1.
when i make a print than all the record is printing and i want that only that record is to print which is on the form.
I am at the beginers level in MS access and do not know about coding. kindly help me out this :confused:

imtiaz
 
Hi. There are a few ways to handle this. For your case, it might be easier to create a query based on table2 but with a criteria based on form1. You can then use this query for report1.
 
thanks the DBguy for your suggestion but the links you have sent are not opening and i am still in problem and waiting for the help
 
thanks pbaldy for your suggestion but i want to print the report which i have designed not the second form
 
can any one help me through photos that can bring me out of the problem
 
theDGbuy please help me how put criteria on the form in the query?
 
Message to the OP
Please be patient. Everyone here is an unpaid volunteer and due to different time zones, it is the middle of the night in the USA where both pbaldy and the DBGuy are based.

As already explained in pbaldy's link, assuming its a text field, the syntax would be something like
Code:
DoCmd.OpenReport "ReportName", acViewPreview, ,"FieldName = '" & Me.ControlName & "'"

If you want to filter using a query, put something like Forms!FormName.ControlName in the filter criteria for the required field. Obviously modify all names to match your database

If that doesn't help, I suggest you use Access help or a Google search.
 
I have one table name as table2, one form name as form1 and one report name as report1.
when i make a print than all the record is printing and i want that only that record is to print which is on the form.
I am at the beginers level in MS access and do not know about coding. kindly help me out this :confused:

imtiaz
Perhaps you could post a copy of your db
 
Make sure you SAVE the record BEFORE opening the report so that the report includes any changes. Remember, the report is pulling data from the underlying table NOT the form.

If Me.Dirty then
DoCmd.RunCommand acCmdSaveRecord
End If

DoCmd.OpenReport ..... (follow the prompt to provide the arguments)
 
You need a WHERE clause when you open the Report.

The Report should load the record WHERE the ID of the record on the Report equals the ID of the record on the form. Example in a macro:

OpenReport.png


You can trigger this with a button on the form. Use the On Click event of the button.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom