View Full Version : "Object Required" Error


andreihortua
09-22-2005, 02:09 PM
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

KenHigg
09-22-2005, 02:26 PM
This looks like the problem:

CnsServiciosAfectados.RecordSource = strSQLPuertosCanales

What is:

CnsServiciosAfectados

???

andreihortua
09-22-2005, 02:34 PM
CnsServiciosAfectados is the query's name

ChrisLomax
09-23-2005, 01:48 AM
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?