can't find strSQL

  • Thread starter Thread starter susan
  • Start date Start date
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 -----------
 
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)
 
Back
Top