S
susan
Hello,
Please see code below:
strSQL returns a set of records. I want this set to be ordered random by
using the strSQL2.
Doing so (better said: trying so) I get error 3078 "Jet-engine can't find
query strSQL."
The errorpointer however points to this line:
Set rs2 = dbsHuidig1.OpenRecordset(strSQL2)
Tooltiptext on rs2 is "rs2 = Nothing"
So the rrormessage points to strSQL and the errorpointer mwnrions strSQL2.
I tested strSQL and that works properly.
Can anyone help?
Using Access 2004,
Thanks,
Susan
Private Sub Knop123_Click()
AANT = Me.t1
' ### -----------
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
' ### -----------
strSQL2 = "SELECT strSQL.titelschoon, strSQL.titel, strSQL.lokatie, " & _
"Rnd(Len([titelschoon])) AS expr1 " & _
"FROM strSQL " & _
"ORDER BY Rnd(Len([titelschoon]));"
' ### -----------
MsgBox strSQL2
' ### -----------
Dim dbsHuidig1 As Database
Dim rs1 As Recordset
Dim rs2 As Recordset
Set dbsHuidig1 = CurrentDb()
Set rs1 = dbsHuidig1.OpenRecordset(strSQL)
Set rs2 = dbsHuidig1.OpenRecordset(strSQL2)
' rs2.MoveFirst
Do Until rs2.EOF
MsgBox rs2!lokatie
rs2.MoveNext
Loop
rs2.Close
' ### -----------
End Sub
Please see code below:
strSQL returns a set of records. I want this set to be ordered random by
using the strSQL2.
Doing so (better said: trying so) I get error 3078 "Jet-engine can't find
query strSQL."
The errorpointer however points to this line:
Set rs2 = dbsHuidig1.OpenRecordset(strSQL2)
Tooltiptext on rs2 is "rs2 = Nothing"
So the rrormessage points to strSQL and the errorpointer mwnrions strSQL2.
I tested strSQL and that works properly.
Can anyone help?
Using Access 2004,
Thanks,
Susan
Private Sub Knop123_Click()
AANT = Me.t1
' ### -----------
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
' ### -----------
strSQL2 = "SELECT strSQL.titelschoon, strSQL.titel, strSQL.lokatie, " & _
"Rnd(Len([titelschoon])) AS expr1 " & _
"FROM strSQL " & _
"ORDER BY Rnd(Len([titelschoon]));"
' ### -----------
MsgBox strSQL2
' ### -----------
Dim dbsHuidig1 As Database
Dim rs1 As Recordset
Dim rs2 As Recordset
Set dbsHuidig1 = CurrentDb()
Set rs1 = dbsHuidig1.OpenRecordset(strSQL)
Set rs2 = dbsHuidig1.OpenRecordset(strSQL2)
' rs2.MoveFirst
Do Until rs2.EOF
MsgBox rs2!lokatie
rs2.MoveNext
Loop
rs2.Close
' ### -----------
End Sub