Full Version: Validate data entry in a form control by re-entering the data
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
I use a form in which the user enters a six digit item number into a control. Before proceeding to the next control, I would like to have a pop up inputbox ask the user to re-enter the six digit item number. If the two entries match, the focus moves to the next control. If the two entries do not match, I would like to have the first control cleared and prompt the user to re-enter the six digit item number before proceeding to the next control.
Is there a code to handle this task?
Use the Before Update event of the control:
If InputBox("Confirm Item Number:", "Confirmation Required") <> Me.YourControlName Then
MsgBox "Entries do not match!", vbOKOnly + vbCritical
Cancel = True
End If
Change YourControlName to the name of the control in question.
welcome to UA forums.
Try this on the before update event of the form:

Dim strValue

strValue = InputBox("Enter Value again", "Value required")

If strValue = "" Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Cancel = True
ElseIf strValue <> Me.YourControl Then
MsgBox "Doesn't Match", vbInformation, "Required Data"
Me.YourControl = Null
Cancel = True
End If

Untested, but should get you the idea.
Good luck
Thank you! I have exactly what I need!!
You're welcome.
Glad we could assist.
Good luck on future projects!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.