I am trying to create a stored proceedure that drops a table from the database.
code
CREATE PROCEDURE SP_DROP
@InputTable as varchar(50)
AS
DROP TABLE InputTable
GO
seems straight forward. I get an error message when I try to pass the parameter to the SP. "Item cannot be found in the corresponding ordinal."
the code in VBA looks like:
Code:
Dim delTable As String
delTable = InputBox("Enter table to delete from the database", "Delete Table")
With DropTable
.ActiveConnection = cn
.CommandText = "SP_DROP"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters(1) = delTable
.Execute
MsgBox "Table Dropped"
End With
error and break on .Parameters(1) = delTable
breaks even if I hard code the table name as well. Any suggestions?
code
CREATE PROCEDURE SP_DROP
@InputTable as varchar(50)
AS
DROP TABLE InputTable
GO
seems straight forward. I get an error message when I try to pass the parameter to the SP. "Item cannot be found in the corresponding ordinal."
the code in VBA looks like:
Code:
Dim delTable As String
delTable = InputBox("Enter table to delete from the database", "Delete Table")
With DropTable
.ActiveConnection = cn
.CommandText = "SP_DROP"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters(1) = delTable
.Execute
MsgBox "Table Dropped"
End With
error and break on .Parameters(1) = delTable
breaks even if I hard code the table name as well. Any suggestions?