Here's what I have so far. It gets the information but only displays the last checkbox information. What I need is to get it for the checkbox that was clicked on.
Sub PassOQInfoToEdit()
Dim c As Control
Dim taskNum As String, task As String
Dim taskDate As Date
For Each c In UserForm1.MultiPage1(3).FrameOQ.Controls
If TypeName(c) = "CheckBox" Then
If c = True Then
taskNum = c.Caption
taskDate = c.ControlTipText
Else: taskNum = c.Caption 'I use the Else because it doesn't matter if the value is True or False. I only need the Caption
End If
End If
Next c
frmOQDate.lbOQtaskNum.Caption = taskNum
frmOQDate.txtOQdate.Value = taskDate
frmOQDate.txtOQEmpName.Value = UserForm1.txtEditEmpName
frmOQDate.txtOQposition.Value = UserForm1.cboxEditPosition
frmOQDate.txtOQVeriforce.Value = UserForm1.txtEditVeriforce
End Sub
I also have the event handler MouseDown on the checkboxes. I use MD so that it doesn't change the value when the checkbox is clicked. It's used to call another UserForm that will update the checkbox value. This works too, but I'm trying to get a MouseDown or click event if any of the 16 checkboxes are clicked, and to get the information for that particular checkbox. Right now I have to right code for each checkbox individually.
Private Sub ckboxEdit201_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim iReply As MsoAlertButtonType
iReply = MsgBox(Prompt:="Are you sure you want to make changes? ", _
Buttons:=vbYesNo, Title:="Confirm Action")
If iReply = vbNo Then
If Me.ckboxEdit201.Value = True Then
Me.ckboxEdit201.Value = True 'Keeps the value so that if they decide to
Else: Me.ckboxEdit201.Value = False 'cancel, they won't have to click the checkbox again
End If
Exit Sub
Else:
PassOQInfoToEdit
frmOQDate.Show
End If
End Sub
Bookmarks