user123137 user123137 - 1 month ago 9
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


Thanks

Answer Source

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