S
Stuart
Here is my (not working) attempt to only enable
the OKButton if all entries in col2 of the listbox
are filled with text values
More correctly, if there is a value in col1, then
there should be some value against it in col2.
Private Sub OKButton_Click()
Dim i As Integer, missing As Integer
lbDataCode.BoundColumn = 2
missing = 0
For i = 0 To lbDataCode.ListCount - 1
If lbDataCode.Value = "" Then
missing = missing + 1
End If
Next
If missing > 0 Then
'more values are required
MsgBox ("You must complete all Fields _
in Column 2, before you exit.")
OKButton.Enabled = False
Else
OKButton.Tag = "Selected"
CancelButton.Tag = ""
Me.Hide
End If
lbDataCode.BoundColumn = 1
End Sub
How do I test for 'empty' values, please?
Regards.
the OKButton if all entries in col2 of the listbox
are filled with text values
More correctly, if there is a value in col1, then
there should be some value against it in col2.
Private Sub OKButton_Click()
Dim i As Integer, missing As Integer
lbDataCode.BoundColumn = 2
missing = 0
For i = 0 To lbDataCode.ListCount - 1
If lbDataCode.Value = "" Then
missing = missing + 1
End If
Next
If missing > 0 Then
'more values are required
MsgBox ("You must complete all Fields _
in Column 2, before you exit.")
OKButton.Enabled = False
Else
OKButton.Tag = "Selected"
CancelButton.Tag = ""
Me.Hide
End If
lbDataCode.BoundColumn = 1
End Sub
How do I test for 'empty' values, please?
Regards.