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  

Verifying data entry



 
 
Thread Tools Display Modes
  #1  
Old November 16th, 2009, 04:38 PM posted to microsoft.public.access.forms
laura.dodge
external usenet poster
 
Posts: 24
Default Verifying data entry

Hi, I am trying to figure out a way to verify a piece of data entry.
Study ID is in the form of two letters and three numbers (I'm using
the input mask LL000. The first letter will be 'm' for male or 'f'
for female, and the second letter will be 'c' for case and 'x' for
control. There is a separate field for case or control, and boss wants
to make sure that the code matches the case/control field. Can anyone
help me code a macro to check this? Thanks!
  #2  
Old November 16th, 2009, 05:44 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Verifying data entry

Take a look at the BeforeUpdate event for the record. That would be a good
place to do this kind of validation checking.

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.

"laura.dodge" wrote in message
...
Hi, I am trying to figure out a way to verify a piece of data entry.
Study ID is in the form of two letters and three numbers (I'm using
the input mask LL000. The first letter will be 'm' for male or 'f'
for female, and the second letter will be 'c' for case and 'x' for
control. There is a separate field for case or control, and boss wants
to make sure that the code matches the case/control field. Can anyone
help me code a macro to check this? Thanks!



  #3  
Old November 17th, 2009, 05:23 AM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Verifying data entry

Laura -

In the BeforeUpdate event, place code like this:

If Mid(Me.[Study ID],2,1) Me.CaseControlField Then
msgbox("Study ID does not have the correct case/control value")
Cancel = True
End If

The field names will need to be what you have on the form. You can put
whatever in the msgbox you want the user to see. The Cancel will cause the
record not to be written.

--
Daryl S


"laura.dodge" wrote:

Hi, I am trying to figure out a way to verify a piece of data entry.
Study ID is in the form of two letters and three numbers (I'm using
the input mask LL000. The first letter will be 'm' for male or 'f'
for female, and the second letter will be 'c' for case and 'x' for
control. There is a separate field for case or control, and boss wants
to make sure that the code matches the case/control field. Can anyone
help me code a macro to check this? Thanks!
.

  #4  
Old November 17th, 2009, 05:05 PM posted to microsoft.public.access.forms
laura.dodge
external usenet poster
 
Posts: 24
Default Verifying data entry

On Nov 17, 12:23*am, Daryl S wrote:
Laura -

In the BeforeUpdate event, place code like this:

If Mid(Me.[Study ID],2,1) Me.CaseControlField Then
* * * * msgbox("Study ID does not have the correct case/control value")
* * * * Cancel = True
End If

The field names will need to be what you have on the form. *You can put
whatever in the msgbox you want the user to see. * The Cancel will cause the
record not to be written.

--
Daryl S

"laura.dodge" wrote:
Hi, I am trying to figure out a way to verify a piece of data entry.
Study ID is in the form of two letters and three numbers (I'm using
the input mask LL000. The first letter will be 'm' for male or 'f'
for female, and the second letter will be 'c' for case and 'x' for
control. There is a separate field for case or control, and boss wants
to make sure that the code matches the case/control field. Can anyone
help me code a macro to check this? Thanks!
.


Thanks for the help! I tried putting the following in the validation
rule: =([ID001]='*c***' And [FB008]=1) Or ([ID001]='*x***' And [FB008]
=2) but it's popping up the validation text every time. Could this
approach work? Thanks again!
 




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 11:44 AM.


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