Preventing duplicates - can't find a table

Shifty23

New member
Local time
Today, 10:39
Joined
Aug 15, 2013
Messages
2
Access 2007 - I am using the oft used, frequently posted and shard code from srfreemen - modified as below. now I know I sort of broke commandment # 8 - Thou shalt not copy and paste other people's code without at least attempting to understand what it does. but I honestly did try to understand what it does. I keep getting runtime error 3078 - cannot find the input table or query 'tblEnrolment_Committee_Master'. It is the name of a table in my database but I am missign the very basic element of how to get my form (which draws all of it's fields from that table) to look it up or identify it. Likely because of a silly basic error. Normally - I wouldn't attempt such things but my work needs me to ensure no duplicates exist in this case AND it's already a primary key - but I don't want to wait until the whole form is filled out for it to identify the duplicate!

If someone colud please tell me how to get the tblEnrolment_Committee_Master to be included in the search and erase this error - I would greatly appreciate it.
Private Sub Entitlement_File_Number_BeforeUpdate(Cancel As Integer)
Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID = Me.Entitlement_file_Number.Value
stLinkCriteria = "[Entitlement_File_Number]=" & "'" & SID & "'"
'Check StudentDetails table for duplicate StudentNumber
If DCount("Entitlement_File_Number", "tblEnrolment_Committee_Master", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Warning Entitlement File Number " _
& SID & " has already been entered." _
& vbCr & vbCr & "You will now been taken to the record.", _
vbInformation, "Duplicate Information"
'Go to record of original Student Number
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If
Set rsc = Nothing

End Sub
 
Last edited:
Make sure it's spelled exactly that way, and that the actual name doesn't have spaces rather than underscores.
 
I knew it was simple - SPACES - I missed that - was sure I'd used underscores! THANKS
 

Users who are viewing this thread

Back
Top Bottom