Link to home
Start Free TrialLog in
Avatar of bill201
bill201

asked on

how to send a value from a form to a reprt in access 2013

hi

i have a veriable in a form that contain some sql string and i want to send this value to a report recordsorce and then open this report based on this sql source

i wrote this code in the report

Public Sub ControlReport(a As String)
If Not IsNull(a) And Not a <> "" Then
    Me.RecordSource = a
    Me.Requery
End If
End Sub

Open in new window


and in the form i have this code
DoCmd.OpenReport "ListProductrsReport", acViewPreview
reports!ListProductrsReport!ontrolReport (sqlString)

Open in new window

but i don't can to compile the code on the form, what is the problem with my code?

thanks a lot
ASKER CERTIFIED SOLUTION
Avatar of QPR
QPR
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bill201
bill201

ASKER

Yes you are right! Embarrassing :)