Solved

Check for Duplicate from a Textbox

Posted on 2011-09-26
5
236 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
  • 3
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

803 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