rivate Function NameOK() As Boolean
Dim NameCount As Integer
NameOK = True
If Surname & "" = "" Or Forename & "" = "" Then Exit Function
If Surname = Surname.OldValue And Forename = Forename.OldValue Then Exit Function
NameCount = DCount("Surname", "mytab", "Surname = """ & Surname & """ AND Forename = """ & Forename & """")
If NameCount = 1 Then
MsgBox "A PLAYER with this NAME & DOB already exists." & vbLf & vbLf & _
"PLEASE CHECK.", vbCritical, "PLAYERS Name"
NameOK = False
End If
End Function
Private Sub Forename_Exit(Cancel As Integer)
If Not NameOK Then
Cancel = True
End If
End Sub
I could someone check my poor vb and see where I have gone wrong. My database is for registered football players and with over 5000 players i need to check that players have not signed for two clubs hope you can help I will be using surname and DOB in the final version
Dim NameCount As Integer
NameOK = True
If Surname & "" = "" Or Forename & "" = "" Then Exit Function
If Surname = Surname.OldValue And Forename = Forename.OldValue Then Exit Function
NameCount = DCount("Surname", "mytab", "Surname = """ & Surname & """ AND Forename = """ & Forename & """")
If NameCount = 1 Then
MsgBox "A PLAYER with this NAME & DOB already exists." & vbLf & vbLf & _
"PLEASE CHECK.", vbCritical, "PLAYERS Name"
NameOK = False
End If
End Function
Private Sub Forename_Exit(Cancel As Integer)
If Not NameOK Then
Cancel = True
End If
End Sub
I could someone check my poor vb and see where I have gone wrong. My database is for registered football players and with over 5000 players i need to check that players have not signed for two clubs hope you can help I will be using surname and DOB in the final version