Replies to Msg. #1205989
.
 Msg. #  Subject Posted by    Board    Date   
32179 Re: Access Question for Zimbler
   I believe the way I found duplicates was with a query. This site h...
Zimbler0   6TH POPE   23 May 2022
2:53 AM
32176 Re: Access Question for Zimbler
   Zimbler0:

Re: “How to check for a duplicate?”
I'd like my database to tell me each time I enter a new book title or modify an existing one how many books with that name are already in the table. If the answer is 'none,' I wouldn't want it to say anything. I don't want it preventing entry of a duplicate... just informing me with MsgBox.

  • The form is frmMedia.
  • The table is tblMedia.
  • The form has a field named Title.
  • The table has a field named Title.

Do you know how? I've been trying with DCount, like this:


Private Sub Title_lostFocus()
Dim x As Integer
  x = DupTitleCount()
  MsgBox (x)
End Sub

Public Function DupTitleCount() As Integer
  DupTitleCount = DCount("[Title]", "tblMedia", "[tblMedia].[Title] = [frmMedia].[Title]")
End Function








Avatar

Gold is $1,581/oz today. When it hits $2,000, it will be up 26.5%. Let's see how long that takes. - De 3/11/2013 - ANSWER: 7 Years, 5 Months