can't find strSQL

S

susan

Hello,

I get following (Access 2003) error on code below:

Error 3078. Jet-engine can't find table or query strSQL.

What do I do wrong?

Thanks,


Susan



AANT = "25"

strSQL = "SELECT TOP " & AANT & " " & _
" QVarHitsSel.hit, QVarHitsSel.titelschoon, QVarHitsSel.lokkaal, " & _
"QVarHitsSel.lokatie, QVarHitsSel.titel, QVarHitsSel.volg, " & _
"QVarHitsSel.mijnchceck, VarTrackSpecs.toegevoegd " & _
"FROM QVarHitsSel INNER JOIN VarTrackSpecs " & _
"ON QVarHitsSel.titel=VarTrackSpecs.titel " & _
"ORDER BY VarTrackSpecs.toegevoegd DESC;"

' MsgBox strSQL


' XXX -----------
Dim dbsHuidig1 As Database
Dim rs1 As Recordset
Set dbsHuidig1 = CurrentDb()
Set rs1 = dbsHuidig1.OpenRecordset("strSQL")

' rs1.MoveFirst
Do Until rs1.EOF
MsgBox rs1!titelschoon
rs1.MoveNext

Loop
rs1.Close
' XXX -----------
 
B

Bob Barrows

susan said:
Hello,

I get following (Access 2003) error on code below:

Error 3078. Jet-engine can't find table or query strSQL.

What do I do wrong?
strSQL = "SELECT TOP " & AANT & " " & _
Set rs1 = dbsHuidig1.OpenRecordset("strSQL")
You executed a literal string containing the characters "strSQL" rather than
the content of your strSQL variable. It should look like this:

Set rs1 = dbsHuidig1.OpenRecordset(strSQL)
 

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