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
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.