Why doesn't this work?

G

Guest

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
 
G

Guest

Never mind. I figured it out. I had a default value of 0 in the field, so
it was never actually empty. Sorry for the hassle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top