Public Sub UserForm_Initialize()
EditForm.Show
Dim MgrNotes As String
Dim Deactivate As Boolean
MgrNotes = tbMgrNotes.Value
Deactivate = cbDeactivate.Value
End Sub
Public Sub btnSave_Click()
Call OnSave(MgrNotes, Deactivate)
End Sub
Sub OnSave(MgrNotes, Deactivate)
Dim cnn As New ADODB.Connection
Dim iRowNo As Integer
Dim StockUnit As String
With Sheets("Sheet1")
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
cnn.Close
Set cnn = Nothing
Set iRow = Nothing
End With
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE