Validation rules

R

rick

Hi all,

I am currently creating a networking database and i have a textfield for
"subnet
mask" within a table and have correctly setup the input mask -
999\.999\.999\.999;;_
so that data is entered in the correct format as follows:

<1st octet>.<2nd octet>.<3rd octet>.<4th octet>

When data is then entered it would read something like:

255.255.255.000 or 255.248.000.000 etc, etc

My question is, what validation rule do i need to ensure that ONLY numbers
from 0 to 255 can be entered into each section but it must remain a
textfield, I
cannot split it up into seperate numbers because it would over complicate
my data base? I have tried everything and
i got as far as 3 "octets" but then the last allowed me to enter a number
greater than 255.

Also could you help me design it so that i can only enter "0" and not "000"
if this is possible, or make access remove the two leading zeros when "000"
is entered? The same applies to any 1 or 2 digit number, ie 1 instead of
001, or 12 instead or 012.

Many thanks

Scott Ashton
MCP MCDST
 
G

Guest

I suggest you use visual basic code and use the functions that extract part
of a text string (left$, right$, mid$), then use the val() function to
convert each part of the subnet field each function extracts to a number,
then test the result for a range of 0:255.

Place the code in the needed event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top