Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Check for Duplicate from a Textbox

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
GeneBat
Asked:
GeneBat
  • 3
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Try this - attached


checkdupsfromtextbox-MX01.zip
0
 
GeneBatAuthor Commented:
Works great. Thanks!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
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
 
GeneBatAuthor Commented:
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
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
You are welcome ...

mx
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now