"Object Required" Error

andreihortua

Registered User.
Local time
Yesterday, 19:33
Joined
Sep 19, 2005
Messages
12
I get an error message when i click a button says:

"Object Required"

This is the code:
strSQLPuertosCanales is defined outside of the procedure.

Private Sub cbAnexarATemporal_Click()
'Adds query result to a temp table to allow select more devices
On Error GoTo Err_cbAnexarATemporal_Click
Dim strSQLAnexar As String

CnsServiciosAfectados.RecordSource = strSQLPuertosCanales
strSQLAnexar = "INSERT INTO Temporal SELECT DISTINCT * FROM CnsServiciosAfectados;"
DoCmd.RunSQL strSQLAnexar
Exit_cbAnexarATemporal_Click:
Exit Sub

Err_cbAnexarATemporal_Click:
MsgBox Err.Description
Resume Exit_cbAnexarATemporal_Click

End Sub
 
Last edited:
This looks like the problem:

CnsServiciosAfectados.RecordSource = strSQLPuertosCanales

What is:

CnsServiciosAfectados

???
 
CnsServiciosAfectados is the query's name
 
Can you not a breakpoint at the beginning of the code and step through the code until it reaches the point in which the error occurs?

That way we know where the error may be happening?
 

Users who are viewing this thread

Back
Top Bottom