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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|