Re: Incorrect syntax near '='
- From: "Tom Moreau" <tom@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 17 Sep 2005 19:35:04 -0400
For one thing, you don't have a space between the table name and WHERE. How
about printing out the value of strSQL?
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"Denis" <Denis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:15DAF6BC-4809-479E-9B80-10B33955D4C1@xxxxxxxxxxxxxxxx
Greetings,
I have attempted to code the following into a sql server 2000 acccess
database.
strSQL = "SELECT * FROM tblDocumentTypes" & _
"WHERE DocType =" & "'" & DcmntTyp & "'" & ";"
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = strSQL
cmd.CommandType = adCmdText
cmd.Execute
I have also tried
strSQL = "SELECT * FROM tblDocumentTypes" & _
"WHERE DocType = ? ;"
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = strSQL
cmd.CommandType = adCmdText
cmd.Parameters.Append cmd.CreateParameter("iDcmntTypNm", adVarChar,
adParamInput, 50, DcmntTyp)
cmd.Execute
DcmntTyp contains a user entered value from a text box.
I have tried a number of other ways of writing this code but I keep getting
the error "Incorrect syntax near '='".
Any help to resolve this will be greatly appreciated.
--
Denis
.
- Follow-Ups:
- Re: Incorrect syntax near '='
- From: Denis
- Re: Incorrect syntax near '='
- References:
- Incorrect syntax near '='
- From: Denis
- Incorrect syntax near '='
- Prev by Date: Incorrect syntax near '='
- Next by Date: Re: Incorrect syntax near '='
- Previous by thread: Incorrect syntax near '='
- Next by thread: Re: Incorrect syntax near '='
- Index(es):
Relevant Pages
|