validation help

  • Thread starter Thread starter EddWood
  • Start date Start date
E

EddWood

I have a form with a discount option and need to set it so they maximum
value that can be entered is 100, what is the syntax to enter to ensure
users cannot enter any value greater than 100?

Thanks
 
If the discount is entered into a text field named txtDiscount you could do
it on the after update event of this field.

Private sub txtDiscount_AfterUpdate()
if not isnumeric (me.txtDiscount) then
Msgbox("You must enter a nunmeric value")
exit sub
end if

if me.txtDiscount > 100 then
Msgbox("You cannot enter values over 100")
me.txtDiscount = ""
end if

End sub
 
Hi Tore,

I have tried that code, but it still allows me to enter values greater than
100??

Any other suggestions?

Regards
Edd
 
cool guys, sorted it, my datatype is a SQL 'float' type and as such maximum
value is 1.0, sorry thanks for your help

Edd
 

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

Back
Top