|
-
Apr 26th, 2000, 12:47 AM
#1
I'm trying to execute this simple SQL statement and I get this error
Compile Error
Expected: Line Number or Label or statement or end of statement
Here is the sql statement I'm using
Dim strSQL As String
strSQL = "Select * From tblCompany"
"Where cCompName Like '" & cmbCmpName.Text & "'"
DatComp.RecordSource = strSQL
DatComp.Refresh
Not sure if I'm supposed to use the like or not. I left my SQL book at home and I don't work with it every day. So if some can help me out I would appreciate it.
Thank You
Ken Devorak
-
Apr 26th, 2000, 12:54 AM
#2
Addicted Member
I'm not sure this it, but the 2 parts for your SQL statement aren't connected with a line continuation and a ampersand. ie
strSQL = "Select * From tblCompany" & _
"Where cCompName Like '" & cmbCmpName.Text & "'"
-
Apr 26th, 2000, 01:03 AM
#3
Hyperactive Member
You'll also need a space between tblCompany Where such as
strSQL = "Select * From tblCompany " & _
"Where cCompName Like '" & cmbCmpName.Text & "'"
-
Apr 26th, 2000, 01:10 AM
#4
what is tblCompany and cCompName a variables?
then your sql missing more then few &
strSQL = "Select * From " & tblCompany & _
" Where " & cCompName & " Like '" & cmbCmpName.Text & "*'"
i you use Like then mayby you can use *
-
Apr 26th, 2000, 03:01 AM
#5
Fanatic Member
Tip
Just a tip. Use debug.print when working with strings because it is easy to forget things like spaces. :P :P
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|