user123137 user123137 - 6 months ago 47
SQL Question

Access VBA/SQL "Run-Time error '424': Object required"

I keep on getting getting a "Run-Time error '424': Object required" and I am not sure why, when I press debug it takes me to the line

qdf.SQL = strSQL
and highlights it yellow. I was wondering if anybody knows what is the problem?

Sub UpdateX()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String

Set db = CurrentDb
Set rs = db.OpenRecordset("References")

strSQL = "SELECT References.DocNum, References.Availability " & _
"FROM References " & _
"WHERE References.Source = 'Book' " & _
"ORDER BY References.DocNum;"
qdf.SQL = strSQL
DoCmd.OpenQuery "qryTest"
End Sub


Answer Source

qdf is Nothong (null). You need to set qdf to something.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download