Execute Problem

C

CR3

I have a database with the following code from a macro:

DoCmd.TransferSpreadsheet acImport, 8, "Schneidernew", Me.File, False,
"A2:K300"

MsgBox "Data Importing Complete.", , ""

With cmd1
..ActiveConnection = CurrentProject.Connection
..CommandText = "Schneider_Append_DDR;"
..Execute
End With

With cmd1
..ActiveConnection = CurrentProject.Connection
..CommandText = "Update_Carrier_Schneider;"
..Execute
End With

DoCmd.DeleteObject acTable, "Schneidernew"

Import_Schneider_Exit:
Exit Sub


Import_Schneider_Err:
MsgBox Error$
Resume Import_Schneider_Exit
End If
exit_err_error:

End Sub



In the above code, I continue to get an error with this part of the statement:

With cmd1
..ActiveConnection = CurrentProject.Connection
..CommandText = "Schneider_Append_DDR;"
..Execute
End With



The ".Execute" will not work. Does anyone know why this might be happening?

Thank you.
 
G

George Nicholson

In the above code, I continue to get an error with this part of the
statement:
With cmd1
.....

What error are you getting?

What is cmd1 declared as ?
 
R

ricardo ramos

CR3 said:
I have a database with the following code from a macro:

DoCmd.TransferSpreadsheet acImport, 8, "Schneidernew", Me.File, False,
"A2:K300"

MsgBox "Data Importing Complete.", , ""

With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "Schneider_Append_DDR;"
.Execute
End With

With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "Update_Carrier_Schneider;"
.Execute
End With

DoCmd.DeleteObject acTable, "Schneidernew"

Import_Schneider_Exit:
Exit Sub


Import_Schneider_Err:
MsgBox Error$
Resume Import_Schneider_Exit
End If
exit_err_error:

End Sub



In the above code, I continue to get an error with this part of the
statement:

With cmd1
.ActiveConnection = CurrentProject.Connection
.CommandText = "Schneider_Append_DDR;"
.Execute
End With



The ".Execute" will not work. Does anyone know why this might be
happening?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top