Unbound field

Haytham

Registered User.
Local time
Today, 23:16
Joined
Jun 27, 2001
Messages
162
Hi All...
I have an Unbound Field in my form. Wil anybody tell me how to limit the entry to 11 figures only (No and not letters)..
It should be 11 exactly.
Thanks a lot.
 
Wont setting the input mask to

00000000000

do it?

Ian
 
Haytham,

"Fornatian" is right setting the fields input mask to "00000000000" (Minus the ") should do the trick...

Another way you could achieve this is...

Place the following in your BeforeUpdate Event of the Field...

----Start Code----

dim lFieldLength
lFieldLength = 11
if len(me.[YourField]) <> lFieldLength then
MsgBox "Place Your Message Here"
end if

----End Code----

Personally...Fornatian's way will work better...

My Response was only meant to give you an option...


Hope This Helps...

Don
 
Hi .. Thank you for reply.
Well, the input mask will do the work well.
While, if I put the code, it gives me Compile Error.. Invalid Outside Procedure for thid code:lFieldLength = 11

One more thing please.. This field should not be blank. I put the code:
Docmd.cancelevent if no entry but still it passes smoothly.
I tried Exit Sub as well with the same result.
Will it be possible to do so and to limit the entry to figures only and not letters th' code...
Again thanks for your great help.
 
Haytham...

I am not sure why it's giving you a compile error...I typed the code in my first reply although I hadn't tested it at that time...I have used it in the past...I just cut and pasted the above code into an unbound field, changed the [YourField] part and, it worked fine on mine... I am not sure what version you are running... I have now tested the code on both access 2k and, access XP (a.k.a. access 2002).

The Code allowing you to pass on to the next field is one of the things I don't like about the code... This is where my statement "Personally...Fornatian's way will work better..." came from... As I said, the code was only meant as an option you could play with if needed...

Don
 
Set the required property to Yes in table design or deal with the record entry in VBA in the before update event if you know how to use VBA.

Ian
 
donbettis, Hi .. Well I'm using A2k, still it's giving me compile error. I don't know why , I'll keep on trying.
Fornatian, thank you again. Unbound field has no base in table so no way to change its property to required.
Can I disable system msgbox and put mine..
Thanks both of you
 

Users who are viewing this thread

Back
Top Bottom