Locked fields after submit

E

erick-flores

Hello all

I am having a lil of a problem here. This is what I have: A expense
report interface, employees enter their expense information press a
button and submit the report to their manager/accounting. I want to
locked all the fields once the employees submit their reports. They
will be able to see their submitted information but wont be able to
change it (once their submit the report).

I tried using the "locked" option behind my submit button. So I will
say, for example, field = locked But then when the employee re-enter to
the form and try to enter their expenses (new report) it will not let
him because the fields are locked and if I set the load event (for the
form) to unlocked the fields then they will be able to change their old
reports. You know what I mean? It is kinda confusing and I dont know
how to fix this problem

Any ideas???

Thanks in advance
 
J

Joan Wild

Add a yes/no field to your table. When they submit the report update this
field to True.

Then you can change the allow edits, allow deletions property for the form
to No, if the value of this field is true.

You would set these properties in the current event for the form.
 
E

erick-flores

Joan said:
Add a yes/no field to your table. When they submit the report update this
field to True.

Then you can change the allow edits, allow deletions property for the form
to No, if the value of this field is true.

You would set these properties in the current event for the form.

Thanks for your answer that looks like it should correct my problem.
But I am having trouble writing the right code. Can you please give me
more details of the actual code I need to put behind my forms.

I have a form(A) and a subform(B). A has the button that submit the
report, B has the expense information.

How do I modify a subform from a form? this is what I tried:
Forms![Expense Reports Subform].Yes_No_field.Enabled = True
And its not working, what I am doing wrong?

Thank you
 
J

Joan Wild

Include in the code to open the report.
Me![YesNoField] = True
Me.Dirty = False
DoCmd.OpenReport etc.

In the current event for the main form:
If Me![YesNoField] = true then
Me.AllowEdits = false
Me.AllowDeletions = false
else
Me.AllowEdits = True
Me.AllowDeletions = True
End If


--
Joan Wild
Microsoft Access MVP

erick-flores said:
Joan said:
Add a yes/no field to your table. When they submit the report
update this field to True.

Then you can change the allow edits, allow deletions property for
the form to No, if the value of this field is true.

You would set these properties in the current event for the form.

Thanks for your answer that looks like it should correct my problem.
But I am having trouble writing the right code. Can you please give me
more details of the actual code I need to put behind my forms.

I have a form(A) and a subform(B). A has the button that submit the
report, B has the expense information.

How do I modify a subform from a form? this is what I tried:
Forms![Expense Reports Subform].Yes_No_field.Enabled = True
And its not working, what I am doing wrong?

Thank you
 
E

erick-flores

Thanks for your help, that code with a few changes did it.

I have a final question. Everything is working fine, but it is only
checking (the yes/no field) one of the records. This is kinda what I
have:

Expense Date Expense Category Description Reimb Co.
Paid YesNoField
2/2/2002 Business Dev testing
23.34 (+)
2/3/2002 Meal testing
34.34 ( )

I press the submit button and...
It will check the record that is selected but it will not check all the
records-all the expenses, you know what I mean? In the example above it
only check (the YesNoField) the first record. So my question is How do
I checked all the records at the same time?

Any ideas? Thank you
 
J

Joan Wild

I was thinking you'd put the yes/no field in the main form's recordsource -
afterall the 'submitted' applies to it doesn't it?
 

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