Solved

Check for Duplicate from a Textbox

Posted on 2011-09-26
5
248 Views
Last Modified: 2012-05-12
Hi Experts –

I need some help check for duplicates from a form. I want to check and see if my customer is entering a duplicate number in the form and prompt them that they shouldn’t be. I have some code but it’s not working as expected.

You can grab a number from the CLAIMNBR field on the form via copy and paste. Select new record from the record selector paste that number in the CLAIMNBR field tab off the field and a message box should come up tells you it’s a duplicate in the table.

I have code behind the form behind the txtClaimNbr textbox on the BeforeUpdate event.

That’s how I would like it to work.

As always any help is appreciated.

***** see example database *****  


Thanks in advance,

GeneBat

checkdupsfromtextbox.mdb
0
Comment
Question by:GeneBat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 500 total points
ID: 36601383
Try this - attached


checkdupsfromtextbox-MX01.zip
0
 

Author Closing Comment

by:GeneBat
ID: 36601682
Works great. Thanks!
0
 
LVL 75
ID: 36601703
Did you see the change I made?

Removed code from Form BU event, put in text box BU event.

Also, your table name was misspelled in the DLookup().

mx
0
 

Author Comment

by:GeneBat
ID: 36601789
Yes I did. I should have been using the BU event in the Textbox and not the Form. Again thanks a second pair of eyes is alway good. :)
0
 
LVL 75
ID: 36601803
You are welcome ...

mx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question