I'm trying to make a pop message that lists schools with missing emails
I have on the form
Code:
'check to see if two emails or if both are the same
If isBookingBothEmail(rs!SchoolName, rs!SchoolEmail, rs!TeacherEmail, rs ) = False Then
rs.Close
Set rs = Nothing
Exit Sub
End If
the module function is
Code:
'checks to see if emails are duplicates or if emails are missing
Function isBookingBothEmail(strSchoolName As String, strEmail1 As String, strEmail2 As String, Records As dao.recordset) As Boolean
Dim strList As String
Records.MoveFirst
Do While Records.EOF
If IsNothing(strEmail1) Or IsNothing(strEmail2) Then
strList = strList & strSchoolName & vbCrLf
isBookingBothEmail = False
End If
Loop
If isBookingBothEmail = False Then
MsgBox "These schools have prevented emailing as they have missing emails" & vbCrLf & strList
Exit Function
End If
Records.MoveFirst
Do While Records.EOF
If strEmail1 = strEmail2 Then
strList = strList & strSchoolName & vbCrLf
isBookingBothEmail = False
Records.MoveNext
End If
Loop
If isBookingBothEmail = False Then
MsgBox "These schools have prevented emailing as don't have two seperate emails" & vbCrLf & strList
End If
End Function
The problem I find is that rs!schoolname doesn't pass at all - I can't get it to show anywhere and it comes up blank!