« 6TH POPE Home | Email msg. | Reply to msg. | Post new | Board info. Previous | Home | Next

Access Question for Zimbler

By: Decomposed in 6TH POPE | Recommend this post (0)
Mon, 23 May 22 1:56 AM | 40 view(s)
Boardmark this board | 6th Edition Pope Board
Msg. 32175 of 60008
Jump:
Jump to board:
Jump to msg. #

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


- - - - -
View Replies (2) »



» You can also:
« 6TH POPE Home | Email msg. | Reply to msg. | Post new | Board info. Previous | Home | Next