SQL syntax- debug help

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....
 
J

JohnFol

What does the debug of strSQL say?

Cut'n'paste that into the query window and see if it runs.
 
J

Junior

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top