If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
validate field by entering number twice
Hi,
I want to validate a serial number by having the number entered twice. If the numbers do not match I want a message box to pop up alerting the user that the numbers do not match. I was thinking of something along the lines of using On Dirty on the second field with the code IIf ([serialnumber_1][serialnumber_2], [forms]!frmMsgBox). But I can't get this to work. Any suggestions? |
#2
|
|||
|
|||
validate field by entering number twice
Karen
For what purpose...? Why are the users entering a serial number? Is this initial data entry, or is this using the serial number to look something (else) up? On Dirty, I suspect, pertains to the form ... take a look at AfterUpdate on the control. (by the way, in forms in Access, they are "controls". in the tables, they are "fields") Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Karen" wrote in message ... Hi, I want to validate a serial number by having the number entered twice. If the numbers do not match I want a message box to pop up alerting the user that the numbers do not match. I was thinking of something along the lines of using On Dirty on the second field with the code IIf ([serialnumber_1][serialnumber_2], [forms]!frmMsgBox). But I can't get this to work. Any suggestions? |
#3
|
|||
|
|||
validate field by entering number twice
Hi -
When you say "validate" the serial number, what are you really trying to do, i.e. what do you mean by "Valid"? It could mean that it is formatted correctly, or that it references an exisiting item or both, which will determine how you validate it. With your approach, a user could enter the same, but *wrong*, information in both fields, and you might end up with bad data. Can you give us more details, please? John Karen wrote: Hi, I want to validate a serial number by having the number entered twice. If the numbers do not match I want a message box to pop up alerting the user that the numbers do not match. I was thinking of something along the lines of using On Dirty on the second field with the code IIf ([serialnumber_1][serialnumber_2], [forms]!frmMsgBox). But I can't get this to work. Any suggestions? -- John Goddard Ottawa, ON Canada jrgoddard at cyberus dot ca Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
validate field by entering number twice
Hi Karen,
Presuming this is for the original data entry check you could try something like this. I'm using two Text Boxes - txtSerial and txtValidate: Private Sub txtValidate_AfterUpdate() If Me.txtSerial.Value = Me.txtValidate.Value Then MsgBox ("Serial number validated!") Else MsgBox ("You mistyped the serial number. Please try again!") Me.txtSerial.Value = Null Me.txtValidate.Value = Null End If End Sub "Karen" wrote: Hi, I want to validate a serial number by having the number entered twice. If the numbers do not match I want a message box to pop up alerting the user that the numbers do not match. I was thinking of something along the lines of using On Dirty on the second field with the code IIf ([serialnumber_1][serialnumber_2], [forms]!frmMsgBox). But I can't get this to work. Any suggestions? |
Thread Tools | |
Display Modes | |
|
|