R
Ripper
I received this code from Albert Kallal and it works great Except I cannot
seem to get the code to work with combo boxes I populate with information
from queries I use to alphabetize names. Anyone know why it won't work with
the combo boxes?
Private Function MyVerify() As Boolean
Dim colFields As New Collection
MyVerify = False
colFields.Add "Period,Period"
colFields.Add "Reason,Dress Code Reason"
colFields.Add "Student,Student Name" <----combo box (cboStudentName)
colFields.Add "Teacher,Teacher Name"
MyVerify = vfields(colFields)
End Function
Private Function vfields(colFields As Collection) As Boolean
Dim strErrorText As String
Dim strControl As String
Dim i As Integer
vfields = False
For i = 1 To colFields.Count
strControl = Split(colFields(i), ",")(0)
strErrorText = Split(colFields(i), ",")(1)
If IsNull(Me(strControl)) = True Then
MsgBox strErrorText & " is required", vbExclamation, AppName
Me(strControl).SetFocus
vfields = True
Exit Function
End If
Next i
End Function
seem to get the code to work with combo boxes I populate with information
from queries I use to alphabetize names. Anyone know why it won't work with
the combo boxes?
Private Function MyVerify() As Boolean
Dim colFields As New Collection
MyVerify = False
colFields.Add "Period,Period"
colFields.Add "Reason,Dress Code Reason"
colFields.Add "Student,Student Name" <----combo box (cboStudentName)
colFields.Add "Teacher,Teacher Name"
MyVerify = vfields(colFields)
End Function
Private Function vfields(colFields As Collection) As Boolean
Dim strErrorText As String
Dim strControl As String
Dim i As Integer
vfields = False
For i = 1 To colFields.Count
strControl = Split(colFields(i), ",")(0)
strErrorText = Split(colFields(i), ",")(1)
If IsNull(Me(strControl)) = True Then
MsgBox strErrorText & " is required", vbExclamation, AppName
Me(strControl).SetFocus
vfields = True
Exit Function
End If
Next i
End Function