Opening a report from a form

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

Guest

Hello,

Im trying to open a report using a print buton and restrict its records to
the value of a text box on a form. Under a print button I have this code

DoCmd.OpenReport "rpt_SelectMemberRequest", acViewPreview, memberID =
Forms!frm_memberOverrideRequest!txtMemberID

Im getting all the records. I only want the records that match the value in
the text box. Does anyone know how to do this?
 
Use the Immediate Window (Ctrl+G) to ask Access what's going on. For
example, type:
? Forms!frm_memberOverrideRequest!txtMemberID
When you press Enter, what do you get?

If you open your table in design view, what type of field is memberID? Is it
Number, or Text? If Text, you need extra quotes:
"memberID = """ & Forms!frm_memberOverrideRequest!txtMemberID & """"

You did include the underscore at the end of the first line?

What happens if you choose Compile from the Debug menu?
 
Back
Top