Code for opening report (DoCmd) (1 Viewer)

boycie

Registered User.
Local time
Today, 09:35
Joined
Sep 19, 2001
Messages
45
Hi,

I am trying to open a report based on a combo box value but cannot get it to work. The following code works;

DoCmd.OpenReport "rpt1", acViewPreview, , "[CallReasonCode]='SS'"

or

DoCmd.OpenReport "rpt1", acViewPreview, , "[CallReasonCode]='VM'"

but when I take the value from the combo box as follows it does not;

Dim strCode As String

strCode = Me.cmbTest

DoCmd.OpenReport "rpt1", acViewPreview, , "[CallReasonCode]=" & strCode

The combo box is based on a table of call reason codes. The report is based on a query of calls which contain the call reason code.

can anyone see my error

thanks
 

boycie

Registered User.
Local time
Today, 09:35
Joined
Sep 19, 2001
Messages
45
Fixed:

this is the amended code I have finally figured out

DoCmd.OpenReport "rpt1", acViewPreview, , "[CallReasonCode]='" & strCode & "'"
 

Users who are viewing this thread

Top Bottom