Hello all, and thanks for taking the time to help me out here.
Basically, I am trying to set up a validation rule that correlates with an input mask where the user is required to enter select alpha characters followed by a series of numeric characters.
The input mask Auto-enters API, requires an alpha value in upper case, and up to 8 numeric values., as seen here:
"API"<L99999999
Now, the part I am having trouble with is setting up the validation rule. I need for it to check and make sure that either "M" or "A" have been entered following the auto entered "API". The validation rule (as seen below) will do that, but no matter how much I mess with it I can't seem to get it to allow between 1 and 8 numeric values to be entered following the "M" or "A". Values like APIA1234 (or APIM1234) should be accepted just as APIA12345678 (or API12345678) would.
Here is the validation rule so far:
"API" & "" & "M" Or "A"
Again, thanks guys!
6 11021
Hello all, and thanks for taking the time to help me out here.
Basically, I am trying to set up a validation rule that correlates with an input mask where the user is required to enter select alpha characters followed by a series of numeric characters.
The input mask Auto-enters API, requires an alpha value in upper case, and up to 8 numeric values., as seen here:
"API"<L99999999
Now, the part I am having trouble with is setting up the validation rule. I need for it to check and make sure that either "M" or "A" have been entered following the auto entered "API". The validation rule (as seen below) will do that, but no matter how much I mess with it I can't seem to get it to allow between 1 and 8 numeric values to be entered following the "M" or "A". Values like APIA1234 (or APIM1234) should be accepted just as APIA12345678 (or API12345678) would.
Here is the validation rule so far:
"API" & "" & "M" Or "A"
Again, thanks guys!
Your validation rule says that the field value can be "API M" or "A"
Try this:
Left([Field], 4) = "APIM" or Left([Field],4) = "APIA"
Replace [Field] with the name of the field the validation rule applies to.
ADezii 8,834
Recognized Expert Expert
Hello all, and thanks for taking the time to help me out here.
Basically, I am trying to set up a validation rule that correlates with an input mask where the user is required to enter select alpha characters followed by a series of numeric characters.
The input mask Auto-enters API, requires an alpha value in upper case, and up to 8 numeric values., as seen here:
"API"<L99999999
Now, the part I am having trouble with is setting up the validation rule. I need for it to check and make sure that either "M" or "A" have been entered following the auto entered "API". The validation rule (as seen below) will do that, but no matter how much I mess with it I can't seem to get it to allow between 1 and 8 numeric values to be entered following the "M" or "A". Values like APIA1234 (or APIM1234) should be accepted just as APIA12345678 (or API12345678) would.
Here is the validation rule so far:
"API" & "" & "M" Or "A"
Again, thanks guys!
To check if:- The entry begins with API.
- The 4th character is either an A or M, nothing else.
- There is a minimum of 1 and a maximum of 8 digits following the APIA/M.
- All values after the 4th character are Numeric in data type.
- Private Sub txtTest_BeforeUpdate(Cancel As Integer)
-
Dim strValueEntered As String, intCounter As Integer
-
-
strValueEntered = Me![txtTest]
-
-
If Len(strValueEntered) = 0 Or Left$(strValueEntered, 3) <> "API" Then
-
MsgBox "Invalid Entry"
-
Cancel = True
-
Exit Sub
-
End If
-
-
'Does it pass the A & M test?
-
Select Case Mid$(strValueEntered, 4, 1)
-
Case "A", "M"
-
Case Else
-
MsgBox "Invalid Entry"
-
Cancel = True
-
Exit Sub
-
End Select
-
-
'Does it pass the 1 to 8 and Numeric test, namely 1 to 8 digits
-
'after the APIM or APIA?
-
If Len(strValueEntered) >= 5 And Len(strValueEntered) <= 12 Then
-
For intCounter = 5 To Len(strValueEntered)
-
If Not IsNumeric(Mid$(strValueEntered, intCounter, 1)) Then
-
MsgBox "Invalid Entry"
-
Cancel = True
-
Exit Sub
-
End If
-
Next
-
Else
-
MsgBox "Invalid Entry"
-
Cancel = True
-
Exit Sub
-
End If
-
-
'IF YOU EVENTUALLY GET HERE, ALL CONDITIONS WERE MET!
-
End Sub
oh wow thanks guys! Both excellent points :) I will test them out right away here and let you guys know how it works out.
ADezii 8,834
Recognized Expert Expert
oh wow thanks guys! Both excellent points :) I will test them out right away here and let you guys know how it works out.
It seems like you will have to go the VBA route on this one. It would be very difficult to incorporate your 4 Validations Requests into a single Validation Rule that would be all encompassing.
It seems like you will have to go the VBA route on this one. It would be very difficult to incorporate your 4 Validations Requests into a single Validation Rule that would be all encompassing.
I agree. However puppydogbuddy is right about how I botched the original rule I had in mind... can't wait until I reach the Zen level of designing databases you guys are at lol
ok guys, so I have now implemented the script provided by ADezii and its works great. I only had to tweak a few things to make it fit.
The first thing was of course swapping out the "txttest" control name fillers for the actual names of my controls.
The second thing I had to do was add ;0;_ onto the end of my input mask so it recorded the mask data into the table as well as the user entered data. Otherwise the VB script can't find the "API" portion of the data in the table (because it hasn't been entered and does not exist) and kicks back error messages.
Again thanks all for the help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ssmith86 |
last post by:
I have created a DAP linking to only one table. Several of the fields
on the table have validation rules. The only time my message boxe
comes up is when I am finished inputting data on the DAP...
|
by: Tom |
last post by:
How do I set up the following Validation Rules in a table:
1. Two chars - both must be digits(0-9)
2. Three characters - first character must be a letter
3. 6 characters - all must be...
|
by: Jeremy |
last post by:
I have a vb .net 2003 app that uses access 2k as a backend. The main table
has some validation rules (legacy stuff brought forward inadvertantly, and
now we're stuck with 'em).
The problem is,...
|
by: tsnyder |
last post by:
I need to set a validation rule for a field so that it looks at all
other fields to make sure that field is true.
|
by: sesling |
last post by:
I have a form that has several text boxes where the operator can enter data. I want to place some validation rules around what the operator can enter.
In one box I want the number to be at least...
|
by: babamc4 |
last post by:
Hi Experts,
I have just completed designing a new DB and my boss has asked me to put some complicated (I think!) validation rules on to it. My table is below:
1. Index - Autonumber
2....
|
by: jinalpatel |
last post by:
I have two tables Mainfirm and Subfirm. I have everything ready. Now I am entering validation rules like as below in my form fields to protect the tables from bad data. But when I try to enter...
|
by: Wendy Osullivan |
last post by:
I am creating a data base in access 2003 and I was hoping you could help me out with a question I have.
In my table I have fields for first name, middle initial, and last name. My primary key...
|
by: Ruth Barn |
last post by:
When I use a standard append query; 50 of the 10 'pass', 40 do not append due to validation rules. But the 10 are still not actually added to the TASK table after the append is run and they do not...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |