ok I think I have it sorted
I have made
Code:
Dim strScEmailchange As String
strScEmailchange = fixEmail([SchoolEmail], [SchoolName])
[SchoolEmail] = strScEmailchange
strScEmailchange = fixEmail([TeacherEmail], [MergedName])
[TeacherEmail] = strScEmailchange
and
Code:
'fix an email
Function fixEmail(strSemailPull As Variant, strSnamePull As Variant) As String
Dim strEmail As String
Dim strEName As String
Dim strInput As String
strEmail = IIf(IsNull(strSemailPull), "", strSemailPull)
strEName = IIf(IsNull(strSnamePull), "", strSnamePull)
If IsValidEmail(strEmail) = True Then
fixEmail = strEmail
Else
strInput = InputBox(strEName & " has an invalid email, please correct below.", "Bad Email", strEmail)
If strInput <> "" Then
fixEmail = strInput
End If
End If
End Function
and it all seems to work - can you spot anything wrong?