G
Guest
I submitted the below question in a forum and received the below answer. Can
anyone give me clarification on the code. I think it is Visual Basic, which
I know nothing about, and have not been able to get the code to work. I
keeps giving me errors.
<How can I Auto enter current time into one field when "completed" is
selected
from a different combobox.
I am making a form that I want to have a "date finalized" automaticaly
entered when I move the status combobox to "completed". I would also like to
be able to lock that form from being edited. Is this possible and How?
Thanks,
Use the AfterUpdate event for the list box:
if me.MyList="Completed" then
me.MyTimeField = now()
end if
To lock the form use the Current event on the form:
if me.Mylist="Completed" then
if me.allowedits then
me.allowedits=false
end if
else
if not me.allowedits then ' unlocks the form when is not completed
status
me.allowedits=edit
end if
end if
jl5000
Thanks for the responce!
However, I am confused with your syntax. Admitedly I am not a programer.
The form name is "ID#" and the comboBox is named "Status". The Time box is
named "DateFinalized".
If willing, would you give me the syntax. I tried a few different ways but
I always get a syntax error.
Thanks,
MarcTA
I also received this:
See my answer in your other (subject-only) message for the first.
For the latter, you'll need to set the Form's AllowEdits property to
False in the AfterUpdate event of the combo box, if the value is
"Completed". You will *also* need to put code in the Form's Current
event to check the value of the status field, and set the form's
AllowEdits to True or False appropriately.
John W. Vinson[MVP]
Thanks,
MarcTA
anyone give me clarification on the code. I think it is Visual Basic, which
I know nothing about, and have not been able to get the code to work. I
keeps giving me errors.
<How can I Auto enter current time into one field when "completed" is
selected
from a different combobox.
I am making a form that I want to have a "date finalized" automaticaly
entered when I move the status combobox to "completed". I would also like to
be able to lock that form from being edited. Is this possible and How?
Thanks,
Use the AfterUpdate event for the list box:
if me.MyList="Completed" then
me.MyTimeField = now()
end if
To lock the form use the Current event on the form:
if me.Mylist="Completed" then
if me.allowedits then
me.allowedits=false
end if
else
if not me.allowedits then ' unlocks the form when is not completed
status
me.allowedits=edit
end if
end if
jl5000
Thanks for the responce!
However, I am confused with your syntax. Admitedly I am not a programer.
The form name is "ID#" and the comboBox is named "Status". The Time box is
named "DateFinalized".
If willing, would you give me the syntax. I tried a few different ways but
I always get a syntax error.
Thanks,
MarcTA
I also received this:
See my answer in your other (subject-only) message for the first.
For the latter, you'll need to set the Form's AllowEdits property to
False in the AfterUpdate event of the combo box, if the value is
"Completed". You will *also* need to put code in the Form's Current
event to check the value of the status field, and set the form's
AllowEdits to True or False appropriately.
John W. Vinson[MVP]
Thanks,
MarcTA