allow user only to go back, not to proceed

M

mhmaid

hi all
I have some mandotory fields like invoice transaction amount , and before
this field there are many fiels but not mandatory ,
currently i have this code in the exit event of transaction amount
if isnull([transactionamount]) then
msgbox"must enter amt"
cancel=true
end if

but sometimes when the user reaches this field , he may want to go back to
the previos fiel before he enters any amount , may be he didnt enter data in
a prev field .
i.e.want the code to allow user only to go to previous fields , but not to
allow user to go to next fields without entering amount.
is this possible.
 
J

John W. Vinson

hi all
I have some mandotory fields like invoice transaction amount , and before
this field there are many fiels but not mandatory ,
currently i have this code in the exit event of transaction amount
if isnull([transactionamount]) then
msgbox"must enter amt"
cancel=true
end if

but sometimes when the user reaches this field , he may want to go back to
the previos fiel before he enters any amount , may be he didnt enter data in
a prev field .
i.e.want the code to allow user only to go to previous fields , but not to
allow user to go to next fields without entering amount.
is this possible.

Well... that's going against the usual Windows paradigm where the user can
(generally) fill in data in any order they wish.

What you'll need to do is have the later controls disabled - set their Enabled
property to No in the form's Current event; and then in the AfterUpdate (not
exit!) event of the transaction amount, enable the next control (or controls).

My preference though would be to allow the user to enter data in any order
they wish, and put your validation checking in the Form's (not the individual
controls') BeforeUpdate event. This can check for null values in any control
on the form and can be cancelled if the user has left one out.
 
M

mhmaid

thank for response
I going to try what you have suggested , and also will study using the form
events .
thanks alot
mhmaid

John W. Vinson said:
hi all
I have some mandotory fields like invoice transaction amount , and before
this field there are many fiels but not mandatory ,
currently i have this code in the exit event of transaction amount
if isnull([transactionamount]) then
msgbox"must enter amt"
cancel=true
end if

but sometimes when the user reaches this field , he may want to go back to
the previos fiel before he enters any amount , may be he didnt enter data in
a prev field .
i.e.want the code to allow user only to go to previous fields , but not to
allow user to go to next fields without entering amount.
is this possible.

Well... that's going against the usual Windows paradigm where the user can
(generally) fill in data in any order they wish.

What you'll need to do is have the later controls disabled - set their Enabled
property to No in the form's Current event; and then in the AfterUpdate (not
exit!) event of the transaction amount, enable the next control (or controls).

My preference though would be to allow the user to enter data in any order
they wish, and put your validation checking in the Form's (not the individual
controls') BeforeUpdate event. This can check for null values in any control
on the form and can be cancelled if the user has left one out.
 

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