Locking certain records in a form

M

Maroska Krtica

Hi,

I'd like to learn how to lock a certain record in a form. I have a table
with a field "Closed" (Yes/No). Whenever this value is YES, I'd like to lock
all fields in the form for that record - only the field "Zaklenjeno" should
be left unlocked. This rule should apply for the subform fields as well.

Now to the second part of my problem - there is also a sum in the form. It's
a sum from a subform. Whenever I set YES to "Closed", I'd like to write the
sum value from a subform into a field "Total Purchase" in the table
tbl_sif_Date. I know it is normally not good to write sums in a table, but
this one has to be written. So, this field is calculated and should be
written to a table whenever field "Closed"=YES.

Can you please help me?

Thank you very much.

Brad Gourdo
 
R

Rick B

Simple IF statement in your ON CURRENT code and the CHANGE CODE for the
checkbox.

Do a search on "lock fields" or "lock record". This is asked and answered
all the time.
 
M

Maroska Krtica

Thank you, but I'm not yet very fluent with VBA. Can you write the sentence
and I will adapt it for my own use, please? Of course, if it's not too much
bother or too long.
Brad
 
M

Maroska Krtica

Thank you.
How about the second question that I have?
Looking forward to your answer,
Brad
 
B

Brad Gourdo

Rick, I read answers from previous posts.
I followed the steps and also used the code from this answer:
http://groups-beta.google.com/group...ields+on+a+form&rnum=2&hl=en#5745a12b024d1884

Since I'm not fluent in VB, I need direction for putting that procedure
"Public Function LockBoundControls". Where do I put it? I tried putting
it in (object) "General", but I get an error on the form saying
"Compile Error: Sub or Function not defined."

Please, help, I think I'm not far away from reaching my goal.
Brad
 
Top