Error Printing report for current record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I am trying to print a report for the current record only.

This is the code that I am using in the OnClick event of a command button in
a input form:

DoCmd.OpenReport "Rpt_Rental_Detail_Billing_Sheet", , , "Rental_ID = '" &
Me!Rental_ID & "'"

I am getting a data type mismatch here. The Rental ID is an autonumber. Am
I getting the error because DoCmd criteria requires a string? If so, how do
I accomplish what I want to do?
 
Autonumbers are numbers, therefore you don't need to put quotes around their
values:

DoCmd.OpenReport "Rpt_Rental_Detail_Billing_Sheet", , , "Rental_ID = " &
Me!Rental_ID
 
Still not opening current record. Could it be because I am passing
parameters via OpenArgs? Though I am not passing the Rental_ID.
 
It looks like the record is not being created until I leave the form. How do
I get it to update when I click on the command button?
 
I figured it out. What is happening is that the report is being populated by
another query. Because of additional fields that need to be displayed that
are not in the Qry_Rental_Detail. I think I've got it from here if I can get
the "subscript out of range" error figured out.
 
Back
Top