J
jtertin
This is driving me crazy, and I am sure it is something small and
syntax-related that is holding me up:
My Function:
===========================================
Public Function RenameRecipe(RecipeNo As Integer, RecipeName As
String)
Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
' Establish connection.
Set Conn1 = New ADODB.Connection
Conn1.Open "DSN=ESE_DM;UID=sa;PWD=" + stDatabasePassword + ";"
' Execute SP
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "UpdateRecipeName"
Cmd1.CommandType = adCmdStoredProc
Cmd1.Parameters.Refresh
Cmd1.Parameters(1).Value = RecipeNo
Cmd1.Parameters(2).Value = RecipeName
Set rs1 = Cmd1.Execute()
End Function
===========================================
My Call (as tied to a button's click event):
===========================================
Private Sub btnApply_Click()
MsgBox (txtRecNo.Value)
MsgBox (txtNewName.Value)
RenameRecipe (txtRecNo.Value, txtNewName.Value)
cboRecipe.Requery
End Sub
===========================================
The call "RenameRecipe (txtRecNo.Value, txtNewName.Value)" is
highlighted in red and indicates "Compile error: Expected: =". If I
put a bogus "=1" after the call, it works fine until returning from
the RenameRecipe function where it not surprisingly returns "Run-time
error '424': Object Required".
I am certain it has to do with the RenameRecipe function taking
multiple input variables as I have MANY functions in this program
(with only one input variable) that do not have issues. WHAT am I
missing!?
syntax-related that is holding me up:
My Function:
===========================================
Public Function RenameRecipe(RecipeNo As Integer, RecipeName As
String)
Dim Conn1 As ADODB.Connection
Dim Cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
' Establish connection.
Set Conn1 = New ADODB.Connection
Conn1.Open "DSN=ESE_DM;UID=sa;PWD=" + stDatabasePassword + ";"
' Execute SP
Set Cmd1 = New ADODB.Command
Cmd1.ActiveConnection = Conn1
Cmd1.CommandText = "UpdateRecipeName"
Cmd1.CommandType = adCmdStoredProc
Cmd1.Parameters.Refresh
Cmd1.Parameters(1).Value = RecipeNo
Cmd1.Parameters(2).Value = RecipeName
Set rs1 = Cmd1.Execute()
End Function
===========================================
My Call (as tied to a button's click event):
===========================================
Private Sub btnApply_Click()
MsgBox (txtRecNo.Value)
MsgBox (txtNewName.Value)
RenameRecipe (txtRecNo.Value, txtNewName.Value)
cboRecipe.Requery
End Sub
===========================================
The call "RenameRecipe (txtRecNo.Value, txtNewName.Value)" is
highlighted in red and indicates "Compile error: Expected: =". If I
put a bogus "=1" after the call, it works fine until returning from
the RenameRecipe function where it not surprisingly returns "Run-time
error '424': Object Required".
I am certain it has to do with the RenameRecipe function taking
multiple input variables as I have MANY functions in this program
(with only one input variable) that do not have issues. WHAT am I
missing!?