PDA

Click to See Complete Forum and Search --> : VB, dBase & SQL


gravyboy
Aug 29th, 2000, 05:04 AM
I am (forced to) use a dBase IV database an am having real difficulty getting a certain SQL string to work. The code for the bit I am using is:


Private Sub cmdExcep_Click()
Dim sLike$

Set rsMain = Nothing
sLike = "*TEST*"
With dlgOutput.List1
.AddItem "TEST1"
sSQL = "SELECT * FROM " & sFileN & " WHERE " & sFileN & "![ERROR] LIKE '" & sLike & "'" ' sFileN is the .dbf filename eg alpha.dbf
Set rsMain = dbMain.OpenRecordset(sSQL)
End With

End Sub


at runtime I get a runtime error 3075 - syntax error.

Oh and if the code is changed to read


Private Sub cmdExcep_Click()
Dim sLike$

Set rsMain = Nothing
sLike = "*BLOCK*"
With dlgOutput.List1
.AddItem "ACCOUNT BLOCKED"
sSQL = "SELECT * FROM " & sFileN & " WHERE ![ERROR] LIKE '" & sLike & "'"
Set rsMain = dbMain.OpenRecordset(sSQL)
End With

End Sub



I get the 3061 error - to few parameters: expected 1

I kinda need this one quite seriously!