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!
 
Joined
Feb 15, 2008
Messages
5
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top