error messages on currency field

  • Thread starter ai_enjoi via AccessMonster.com
  • Start date
A

ai_enjoi via AccessMonster.com

how can i enable a message box to appear everytime a string letter is
inputted by the user on a currency field? thanks.. the current error message
is the 'value you entered isn't valid for this field.' can i even just change
the message??...
thanks
 
P

Peter Hibbs

I would do it the other way round, that is don't allow your user to
enter any letters in the first place.

If you enter the code below into the On KeyPress event of your
currency field it will only allow the user to press keys 0-9, the full
stop and the BackSpace keys only. The cursor arrow and Delete keys
work as normal.

Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And _
KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub

Change the word YourFieldName for the name of your currency field of
course.

HTH

Peter Hibbs.
 
A

ai_enjoi via AccessMonster.com

Thank you very much Peter..
your idea was far more better than what i had in mind...
More power...


Peter said:
I would do it the other way round, that is don't allow your user to
enter any letters in the first place.

If you enter the code below into the On KeyPress event of your
currency field it will only allow the user to press keys 0-9, the full
stop and the BackSpace keys only. The cursor arrow and Delete keys
work as normal.

Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And _
KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub

Change the word YourFieldName for the name of your currency field of
course.

HTH

Peter Hibbs.
how can i enable a message box to appear everytime a string letter is
inputted by the user on a currency field? thanks.. the current error message
is the 'value you entered isn't valid for this field.' can i even just change
the message??...
thanks
 
A

ai_enjoi via AccessMonster.com

Thank you very much Peter..
your idea was far more better than what i had in mind...
More power...


Peter said:
I would do it the other way round, that is don't allow your user to
enter any letters in the first place.

If you enter the code below into the On KeyPress event of your
currency field it will only allow the user to press keys 0-9, the full
stop and the BackSpace keys only. The cursor arrow and Delete keys
work as normal.

Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And _
KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub

Change the word YourFieldName for the name of your currency field of
course.

HTH

Peter Hibbs.
how can i enable a message box to appear everytime a string letter is
inputted by the user on a currency field? thanks.. the current error message
is the 'value you entered isn't valid for this field.' can i even just change
the message??...
thanks
 
P

Peter Hibbs

Glad to be of help.

Peter Hibbs.

Thank you very much Peter..
your idea was far more better than what i had in mind...
More power...


Peter said:
I would do it the other way round, that is don't allow your user to
enter any letters in the first place.

If you enter the code below into the On KeyPress event of your
currency field it will only allow the user to press keys 0-9, the full
stop and the BackSpace keys only. The cursor arrow and Delete keys
work as normal.

Private Sub YourFieldName_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) Like "[!0-9.]" And _
KeyAscii <> vbKeyBack Then KeyAscii = 0
End Sub

Change the word YourFieldName for the name of your currency field of
course.

HTH

Peter Hibbs.
how can i enable a message box to appear everytime a string letter is
inputted by the user on a currency field? thanks.. the current error message
is the 'value you entered isn't valid for this field.' can i even just change
the message??...
thanks
 

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

Top