Im stuck on trying to get two values (a string, and a checkbox) from an Excel user form to another Sub. Receiving 'Object Required' on the User Form code. I have researched and tried different methods to no avail. My codes are below:
Public Sub UserForm_Initialize()
Dim MgrNotes As String
Dim Deactivate As Boolean
MgrNotes = tbMgrNotes.Value
Deactivate = cbDeactivate.Value
Public Sub btnSave_Click()
Call OnSave(MgrNotes, Deactivate)
Sub OnSave(MgrNotes, Deactivate)
Dim cnn As New ADODB.Connection
Dim iRowNo As Integer
Dim StockUnit As String
cnn.Open "my connection string"
'Read Stock Unit # From Selected Row and Run UPDATE Queries
iRowNo = ActiveCell.Row
StockUnit = .Cells(iRowNo, 1)
cnn.Execute ("UPDATE Table SET fMgrNotes = '" & MgrNotes & "' WHERE (StockUnit = '" & StockUnit & "') UPDATE Table SET ActiveFlag = 0 WHERE " & Deactivate & " = TRUE AND (StockUnit = '" & StockUnit & "')")
'Close All and Cleanup
Set cnn = Nothing
Set iRow = Nothing
The Call statement line is where the error occurs.
Thanks in advance.