Locking txt fields on a form


S

Simon

i have a database that i use for online shop, once an order is
complest a tick box is ticked txtComplete.

Is there a way i can lock all txt fields with in the form and subform
so no data can be changed by accidend

Thanks

SImon
 
Ad

Advertisements

J

Jeff Boyce

Simon

One approach would be to add a function that iterates through each control,
checking to see if each is a textbox, and if it is, setting the .Enabled
property to the opposite of the 'tick box'.

By the way, if I'm thinking of the same thing, a 'tick box' (check box)
should be a checkbox control, not a text control. The name you gave
(txtComplete) implies that it is a textbox control.

Or you could look into turning off the "Edit" capabilities of the form when
the tick box is ticked.

(but couldn't someone 'hack' around this by un-ticking the tickbox?)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Ad

Advertisements

A

Arvin Meyer [MVP]

you can put this code in a module saving the module as basLocking and call
it in the AfterUpdate event of your check box:

http://www.datastrat.com/Code/LockIt.txt

Copy and paste the code with the function name Unlockit() and use it to
unlock the fields in the next record, or you can use something like this:

Sub Form_Current()
If Me.txtComplete = True Then
Call Unlockit()
Else
Call Lockit()
End If
End Sub
 

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