Print a report with only one record from the DB

  • Thread starter Thread starter Trevor Kish
  • Start date Start date
T

Trevor Kish

I have a database that is keeping track of equipment as it
signed out and in. I need to be able to print out a
report for a specific record in that database from one of
our tables.

I have looked at the DoCmd.OpenReport method and have the
current code:

DoCmd.OpenReport stDocName, acViewPreview, , EENumber =
Forms!LaptopInfo!EENumber

I would think that it should just create a report off of
that EENumber from the form. However, this is not the
case. When click on my preview report button from the
form, it still comes up with all of the records from the
table, not the specific one from the form.

Any help would be greatly appreciated.

Trevor
 
DoCmd.OpenReport stDocName, acViewPreview, , _
"EENumber = " & Forms!LaptopInfo!EENumber

Note: if EENumber is actually a text field, you need extra quotes:

DoCmd.OpenReport stDocName, acViewPreview, , _
"EENumber = """ & Forms!LaptopInfo!EENumber & """"
 
Thanks Allen - It did the trick!
-----Original Message-----
DoCmd.OpenReport stDocName, acViewPreview, , _
"EENumber = " & Forms!LaptopInfo!EENumber

Note: if EENumber is actually a text field, you need extra quotes:

DoCmd.OpenReport stDocName, acViewPreview, , _
"EENumber = """ & Forms!LaptopInfo!EENumber & """"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.




.
 
Back
Top