Print the current record in a report using a form (1 Viewer)

imtiazali266

Registered User.
Local time
Yesterday, 19:45
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
 

theDBguy

I’m here to help
Local time
Yesterday, 19:45
Joined
Oct 29, 2018
Messages
10,258
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.
 

imtiazali266

Registered User.
Local time
Yesterday, 19:45
Joined
Jan 22, 2020
Messages
11
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
 

imtiazali266

Registered User.
Local time
Yesterday, 19:45
Joined
Jan 22, 2020
Messages
11
thanks pbaldy for your suggestion but i want to print the report which i have designed not the second form
 

imtiazali266

Registered User.
Local time
Yesterday, 19:45
Joined
Jan 22, 2020
Messages
11
can any one help me through photos that can bring me out of the problem
 

imtiazali266

Registered User.
Local time
Yesterday, 19:45
Joined
Jan 22, 2020
Messages
11
theDGbuy please help me how put criteria on the form in the query?
 

isladogs

CID Moderator
Staff member
Local time
Today, 03:45
Joined
Jan 14, 2017
Messages
13,215
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.
 

bob fitz

AWF VIP
Local time
Today, 03:45
Joined
May 23, 2011
Messages
3,762
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:45
Joined
Feb 19, 2002
Messages
28,780
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)
 

zeroaccess

Active member
Local time
Yesterday, 21:45
Joined
Jan 30, 2020
Messages
586
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 (Users: 0, Guests: 1)

Top Bottom