Error Message (Missing Operators)

Joined
Feb 15, 2008
Messages
5
Reaction score
0
Hi,

I also have a SQL question:

Dim conn As ADODB.Connection
Dim rst As New ADODB.Recordset
Set conn = CurrentProject.Connection
Dim curArtist As String

rst.Open "SELECT Artist FROM Artist_Information WHERE Artist = " & curArtist, conn, adOpenForwardOnly, adLockReadOnly

--> Here I get a syntax error (missing Operator) for 'Artist='

Why is that?

The code goes on:

While Not rst.EOF
curArtist = rst.Fields(0)
If curArtist = "Anna Ternheim" Then
MsgBox ("Biography: Anna Ternheim was born in 1976" )
End If
rst.MoveNext
Wend



Thanks!
 
Hi,


ok, seems like it should be
rst.Open "SELECT Artist FROM Artist_Information WHERE Artist =


' " & curArtist & " ' ", conn, adOpenForwardOnly, adLockReadOnly,

since curArtist is a string.

Cheers,
Annika
 
Back
Top