TextBox Data Format Validation

usermj

Registered User.
Local time
Today, 02:38
Joined
Dec 12, 2004
Messages
39
I created a TextBox in the Form, which supposes to only take general number value.

In the properties box of textbox, I set the Format property (in Format Tab) to general number. This did help me validate the value I input with the system warning message pop-up box if data type doens't match. But I bit wonder whether I can create and use my own Warning Message box instead of system default one.

So how can I catch that error exception and launch my message box? should I do sth by use of VBA?

Many Thanks
 
Would the validation rule / text work at the table level for this?

kh
 
KenHigg said:
Would the validation rule / text work at the table level for this?

kh


Oh..... Could you please give me a quick indication on using validation rule if convenience?

Thanks
 
Look up 'ValidationRule' in Access help. It'll get you started. I'm not 100% sure this is what you're looking for but maybe it'll help...

kh
 
Sure you can...

On your text box....

You goto event.

OnChange()
dim chk as string
chk = txtDecrs1.text
if Isnumeric(chk) then
else
msgbox("Entry must be of numeric values only buddy!", vbokonly,"Bad DATA!")
end if

You can write nicer messages... :cool:

There may be a syntax error, as I just wrote this off the top of my head...
 
.

I added this because if you change validation at table level.

You still get access entry messages... and my boss hates them....
 
Good idea...

Maybe:

Code:
BeforeUpdate()

dim strChk as string
strchk = me!txtDecrs1

if not Isnumeric(strChk) then
  msgbox("Entry must be of numeric values only buddy -o- pal!", vbokonly,"Bad DATA!")
  DoCmd.CancelEvent
end if

end sub


kh
 
Hi guys,

Thanks for your help.

Due to all your description, it seems two things will be the key issues in this case:

1) Isnumeric() function helps us validate the input value

2) Use the right event to call that Isnumeric () function.

Many Thanks. :)
 

Users who are viewing this thread

Back
Top Bottom