S
Steve Mulhall
Hi all,
Can I add validation to an input box? i.e. I have a button
that when pressed loads a box in which the user can enter
an e-mail address and then press 'OK' and an e-mail is
loaded containing data from the database. The box that is
loaded is called using the InputBox function and thus
already has an 'OK' & 'Cancel' button.
The problem is, regardless of whether the user
presses 'OK' or 'Cancel', an e-mail is loaded and
populated with the correct data. But what I need is if the
user presses 'Cancel' to simply do nothing and return to
the database, or if the user doesn't enter anything in the
box and presses 'OK' for an error message to be generated
(telling them to enter an e-mail address - without this
validation if the user does not enter anything in the box
and presses 'OK' and e-mail is loaded but with a
blank "To:" field - I'd like to avoid this if possible).
The problem I have is that I have usually done this sort
of validation based on whether a user presses a certain
button on a message box e.g. if user presses OK then do
something otherwise do something else (If Response = 1
then "Action1" Else If Response = 0 Then "Action2") the
problem is, regardless of whether the user presses 'OK'
or 'Cancel' on the on the InputBox, the response value is
always 1 and therefore I cannot validate in the way I have
described above. Any ideas?
Hope this all makes sense?
Steve
Can I add validation to an input box? i.e. I have a button
that when pressed loads a box in which the user can enter
an e-mail address and then press 'OK' and an e-mail is
loaded containing data from the database. The box that is
loaded is called using the InputBox function and thus
already has an 'OK' & 'Cancel' button.
The problem is, regardless of whether the user
presses 'OK' or 'Cancel', an e-mail is loaded and
populated with the correct data. But what I need is if the
user presses 'Cancel' to simply do nothing and return to
the database, or if the user doesn't enter anything in the
box and presses 'OK' for an error message to be generated
(telling them to enter an e-mail address - without this
validation if the user does not enter anything in the box
and presses 'OK' and e-mail is loaded but with a
blank "To:" field - I'd like to avoid this if possible).
The problem I have is that I have usually done this sort
of validation based on whether a user presses a certain
button on a message box e.g. if user presses OK then do
something otherwise do something else (If Response = 1
then "Action1" Else If Response = 0 Then "Action2") the
problem is, regardless of whether the user presses 'OK'
or 'Cancel' on the on the InputBox, the response value is
always 1 and therefore I cannot validate in the way I have
described above. Any ideas?
Hope this all makes sense?
Steve