How can I confirm correct data entry using a second matching data field

  • Thread starter moe leaer via AccessMonster.com
  • Start date
M

moe leaer via AccessMonster.com

I am setting up a form that has the user enter a NON-Duplicate part number, but I would like them to have to RE-ENTER the part number in a pop-up form field over the existing form to make sure their ORIGIONAL entry was correct.

Then the box will close and they will be able to save the confirmed Part Number data and print a receipt.

I have tried using the CONFIRM command to = the original part number field with a "wrong Confirmed Part Number" dialog, with NO LUCK. :-(

Can anyone Lend some guidance?

Thanks all,

Moe
 
A

Allen Browne

How would you feel about putting an unbound text box on the same form, where
the person enters the part number a 2nd time? That seems to me the least
obtrusive interface.

Now it's just a matter of canceling the Before Update event procedure of the
form if the 2 numbers do not match. Use the Current event of the form to
clear the unbound box if it is a new record, or to populate it with the
original value if it is an existing record.

The reason for constructing the If block with do nothing, is that the Else
fires for all cases except where the values match, i.e.:
- if Part Number is left blank,
- if txtDupe is left blank, or
- if they are different.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.[Part Number] = Me.txtDupe Then
'do nothing
Else
Cancel = True
MsgBox "Part numbers do not match."
End If
End Sub

Private Sub Form_Current()
If Me.NewRecord Then
Me.txtDupe = Null
Else
Me.txtDupe = Me.[Part Number]
End If
End Sub
 
J

John Nurick

Now it's just a matter of canceling the Before Update event procedure of the
form if the 2 numbers do not match. Use the Current event of the form to
clear the unbound box if it is a new record, or to populate it with the
original value if it is an existing record.

A weakness of this sort of validation is that savvy users can simply
copy-and-paste their first entry into the second textbox. To prevent
this, one could put code in the Enter event procedure of the second
textbox that compares the text on the clipboard with the contents of the
first textbox and - if they're the same - clears the clipboard.
 
M

moe leaer via AccessMonster.com

The unbound Data field worked great. I was wondering if it would be possible to make that field manditory for the user.

If the entered number was a match, it would allow them to continue to the save button, else it would look them back to the Lot number field to enter the correct lot number and then reconfirm the new entry again before they would be alloed to save.

Now it seems to just let them go back and change the origional and or just save without entering data in the confirmation field.

Thanks again all,

Moe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top