D
Dave
Can anyone give me a clue as to why the following code is failing at the
"cmd.execute" line with a message "closed or invalid connection object:"
Dim objConn As ADODB.Connection
Dim cmd As New ADODB.Command
Dim sql As String
Set objConn = CurrentProject.Connection
sql = "SELECT * FROM test WHERE testid=1"
MsgBox (sql)
cmd.CommandText = sql
cmd.CommandType = adCmdText
cmd.Execute
Set cmd = Nothing
Set objConn = Nothing
"cmd.execute" line with a message "closed or invalid connection object:"
Dim objConn As ADODB.Connection
Dim cmd As New ADODB.Command
Dim sql As String
Set objConn = CurrentProject.Connection
sql = "SELECT * FROM test WHERE testid=1"
MsgBox (sql)
cmd.CommandText = sql
cmd.CommandType = adCmdText
cmd.Execute
Set cmd = Nothing
Set objConn = Nothing