Report data doesnot printing... (1 Viewer)

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
Hello !
I want to print form current data print order by EmployeeID.
I have two pages report. Print view showed data but print out command do not printing data. It is printing manually inserted reports data only.
I try this code
Code:
Private Sub cmdPrint_Click()
'Print current record
If IsNull(Me!txtEmployeeID) Then
    MsgBox "Please enter an employee ID", vbOKOnly, "Data Required"
    Exit Sub
End If
DoCmd.OpenReport "rptBackVacation", acViewReport, , EmployeeID = " & Me!txtEmployeeID"
Me.Visible = False

End Sub
Advance thanks.
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
I try to delete at first time but Delete and click save button then I was instead again automatically.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:34
Joined
Oct 29, 2018
Messages
21,358
I try to delete at first time but Delete and click save button then I was instead again automatically.
Sorry, could you please elaborate on that. I don't think I understand what you mean.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:34
Joined
Sep 21, 2011
Messages
14,050
Shouldn't that be
Code:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
Shouldn't that be
Code:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
I try it. But when I give enter new line or click save button then it is [ " ](double quote ) insert automatic.
again I explain
I insert code like:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
but when I put enter or save button then code show
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID"

after that I try
DoCmd.OpenReport "rptBackVacation", acViewPreview, , EmployeeID = " & Me!txtEmployeeID
but when I put enter or save button then code show like
DoCmd.OpenReport "rptBackVacation", acViewPreview, , EmployeeID = " & Me!txtEmployeeID"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:34
Joined
Oct 29, 2018
Messages
21,358
Shouldn't that be
Code:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
Good catch!
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
Maybe I do not explain you well. I have attached my db.
 

Attachments

  • ReportNotPrint.accdb
    1.1 MB · Views: 283

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
I cannot open the DB due to my access version. :(

In the meantime, try putting "EmployeeID = " & Me!txtEmployeeID into a string variable and use that instead.?
Thank you so much, its work, Now displayed data.
But show 3 pages, I have setup two pages why showed one page more I dont know.
I used, "Insert Page Break" button for create page number 2.
and when I give print command (Ctrl +P) then printing all records.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:34
Joined
Sep 21, 2011
Messages
14,050
If you put the criteria into a string variable, you can debug.print it ?
The report will print whatever the data is supplied to it?
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
If you put the criteria into a string variable, you can debug.print it ?
The report will print whatever the data is supplied to it?
I dont have any criteria..

Edit/
I used this command
Code:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806
I thing I dont perfectly setup my second pages. I dont have any idea about report page setup. you see my Report Footer I put "Insert Page Break" button Icon(...). And after that I put data in second page.
can you check please. if possible give me two pages report setup sample. Thank you.
Capture.JPG
 

smtazulislam

Member
Local time
Today, 12:34
Joined
Mar 27, 2020
Messages
806

Gasman

Enthusiastic Amateur
Local time
Today, 09:34
Joined
Sep 21, 2011
Messages
14,050
I dont have any criteria..

Edit/
I used this command
Code:
DoCmd.OpenReport "rptBackVacation", acViewReport, , "EmployeeID = " & Me!txtEmployeeID
"EmployeeID = " & Me!txtEmployeeID is your criteria?
 

Users who are viewing this thread

Top Bottom