Hello -
I have a feeling there is a simple solution for my question. I have a checkbox on my userform and when I save the record is saves the value as True or False in the DB which makes sense. However, when I edit the record, how do I show the checkbox being checked when the database shows the record as True.
Below is some of the code when I edit the record from the listbox but the last line is for the only checkbox on the userform. I know the code isn't correct and read a number of posts but couldn't find a solution.
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'Code to update the value to respective controls
Me.txtRowNumber.Value = Application.WorksheetFunction.Match(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0), _
ThisWorkbook.Sheets("Database").Range("A:A"), 0)
txtBusCal17.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 122)
txtDueDate17.Value = Format(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 123), "mm/dd/yyyy")
txtComplete17.Value = Format(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 124), "mm/dd/yyyy")
CheckBox1.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 128)
I have a feeling there is a simple solution for my question. I have a checkbox on my userform and when I save the record is saves the value as True or False in the DB which makes sense. However, when I edit the record, how do I show the checkbox being checked when the database shows the record as True.
Below is some of the code when I edit the record from the listbox but the last line is for the only checkbox on the userform. I know the code isn't correct and read a number of posts but couldn't find a solution.
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'Code to update the value to respective controls
Me.txtRowNumber.Value = Application.WorksheetFunction.Match(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0), _
ThisWorkbook.Sheets("Database").Range("A:A"), 0)
txtBusCal17.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 122)
txtDueDate17.Value = Format(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 123), "mm/dd/yyyy")
txtComplete17.Value = Format(Me.lstDatabase.List(Me.lstDatabase.ListIndex, 124), "mm/dd/yyyy")
CheckBox1.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 128)