Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent: small problem need to be fixed 1

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
I met a problem when I ran my query after changing the datatype from number into text in MS ACCESS database.
My Query is:

strSQL11 = "Select * from FORM_ID_198163500" where BaylorId =" & session("BaylorID")

when BaylorID is number the query works fine. When I changed it into text. It gave me error:

Microsoft JET Database Engine error '80040e10'

No value given for one or more required parameters


I do not know how to fix

Need your help

Haijun
 
If your parameter is text, you need to surround the value with single quotes:

strSQL11 = "Select * from FORM_ID_198163500" where BaylorId ='" & session("BaylorID") & "'"
 
Thank you very much. I fixed the problem. But if I need to add GROUP BY to this query, how to do it? I tried several times, still did not work.

The workable query:
strSQL11 = "Select * from FORM_ID_198163500 where BaylorId =""" & session("BaylorID") & """"

I add in this way, which did not work:
strSQL11 = "Select * from FORM_ID_198163500 where BaylorId =""" & session("BaylorID") & """ & "GROUP BY Category""

Still need help

Haijun
 
You need to add a space before your Group By statement:

strSQL11 = "Select * from FORM_ID_198163500" where BaylorId ='" & session("BaylorID") & "' GROUP BY Category"

The easiest way to debug SQL statements is to write them to the screen before you try to execute... that way you will see any spacing errors, mismatched quotes, unexpected values, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top