A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

validate field by entering number twice



 
 
Thread Tools Display Modes
  #1  
Old November 17th, 2009, 05:24 PM posted to microsoft.public.access.forms
Karen
external usenet poster
 
Posts: 1,223
Default 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  
Old November 17th, 2009, 06:02 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old November 17th, 2009, 06:19 PM posted to microsoft.public.access.forms
J_Goddard via AccessMonster.com
external usenet poster
 
Posts: 221
Default 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  
Old November 17th, 2009, 11:07 PM posted to microsoft.public.access.forms
Nigel
external usenet poster
 
Posts: 185
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.