SQL syntax- debug help

  • Thread starter Thread starter Junior
  • Start date Start date
J

Junior

Tina and John Vinson - helped me in a prior msg to convert ServiceID from
number to string
I'm trying to use this in a function with the parameter passed from a
control on a report.

Below is the recommended syntax from Tina and John. however, with this SQL -
I get runtime error 3061 - too few parameters, expected 2

strSQL = "SELECT * FROM QrptSum WHERE ServiceID ='" & strSVCID & "'"
debug displays - strSVCID ="05"

From the function

Public Function GetReasons(strSVCID As String)
debug displays - strSVCID ="05"

Set rst = dbs.OpenRecordset(strSQL)
debug highlights this line and displays - SELECT * FROM QrptSum WHERE
ServiceID ='05"'"

this works in query design window but
apparently, i'm not matching ServiceID and strSVCID in SQL
Help please....
 
What does the debug of strSQL say?

Cut'n'paste that into the query window and see if it runs.
 
John thanks for advice - turns out the problem is i am using a parameter
query as record source and this won't work without more VBA which i'll have
to learn...
 
Back
Top