how to use validation rule in ms access

I am working on an ms access project in vb-6 on a windows 95 platform.I am using dbgrid control to view my database on the fronthand (vb).Database has the following field
"input",records are
0001,0002,0003,0004.The user has the capability to add more  records when he requires,but there is a range of (0001--0100)
he cannot add any number except from these.
I have set dbgrid1.addnew=true,dbgrid.delete=true.what I want is to have some validation rule which checks whether the data entered is in the record or not,if not it should give an error message.I tried giving input>0001 and input <0100 in validation rule but it gives a command "type mismatch" for any value changed
kindly help
kapil
kapilkhoslaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kapilkhoslaAuthor Commented:
Edited text of question.
0
BrianWrenCommented:
It would appear from what you have above, (leading 0's), that the data are type String.  To make the comparison given the way you have indicated that you want to do it you should have, (to eliminate the mismatch), Input > "0001", etc.

But since you are looking for what is really a numeric range, I recommend Val(input) >= 1 And Val(input) <= 100, (<= and >= to permit the inclusion of 1 and 100).

Brian
0
KingSunCommented:
I suggest to use "0001" instead of val() function. Since user maybe input something like "01.5" by error typing.

so a validate rule input>"0001" and input<"0100" is enough.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

brewdogCommented:
any news, kapilkhosla?
0
brewdogCommented:
again I ask, any news, kapilkhosla? :o)
0
brewdogCommented:
yet again . . . I hope I don't have to type this too many times :o)
0
BrianWrenCommented:
Maybe you could make a shortcut to do this by mouse click.  It looks like kapilkhosla doesn't like us much ;-(

Brian
0
brewdogCommented:
that's a good idea, Brian. I could create a scrap and then just drag it into the window. :o) Hope all the notifications you're receiving about my comments aren't bothering you.
0
BrianWrenCommented:
Who?  Me?!?  Bothered?  But brewdog!  You know that you're always welcome in my inbox...  (It's better when you are not there for receiving points on a question that I've answered though . . . )
0
brewdogCommented:
speaking of which, I just got notification of points for a question I answered as I'm dredging through the oldies. :o) I'm in the top 25 overall now. I figure I won't catch Trygve for a loooooong time (when you get past Helicopter it takes a while to make up the points), so I'm concentrating on moving up one spot a week in the Hall of Fame. When am I going to see you in that H of F?
0
BrianWrenCommented:
The way things have gone lately, I'll never make it!  I've been aced out of more questions this week!

Dedushka answered one overnight that I was working on that was a 1,000 pointer!

Shoot!
0
brewdogCommented:
1000? I didn't even see that one. I know what you mean, though. EE seems to be growing by leaps and bounds, and while that is good in many ways, it certainly slices the points pie a little smaller.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.