After Update Dilemma (1 Viewer)

voliva67

New member
Local time
Today, 06:33
Joined
Oct 20, 2014
Messages
6
Ok since I was just not able to get my Before update event to function I chose to switch to an After update event. My table is called Apps OS and the form is called Apps OS form, I just have one field called Club Number where I track club ID numbers that I want to make sure is never duplicated in future entries, this is how I wrote the event in the Form under Club Number field, I am still not getting the message box to appear can anyone assist me in detail to what I need to change? Thank you:


Private Sub Club_Name_AfterUpdate()
Dim ClubNumber As String
Dim stLinkCriteria As String
ClubNumber = Me.Club_Number.Value
stLinkCriteria = "[club_number] = " & "'" & Club_Number & "'"
If Me.Club_Number = DLookup("[ClubNumber]", "tbl_AppsOS", stLinkCriteria) Then
MsgBox "This Club, " & ClubNumber & ", has already been entered in database." _
& vbCr & vbCr & "Please check club number again.", vbInformation, "Duplicate information."
Me.Undo
End If

End Sub
 

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 09:33
Joined
Oct 17, 2012
Messages
3,276
If all you want is to ensure that the single field is unique, why not just create a unique index on that field at the table level?
 

Users who are viewing this thread

Top Bottom