Re: Lock a form: Locked property of subform

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Andre,

There is also a Locked property of the subform control (that has SourceObject, LinkMasterFields, LinkChildFields, etc)

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com



Andre Thompson wrote:
Hi Allen

How do I unlock the subform(s)?


"Allen Browne" wrote:


Open your form in design view, and set these properties:
Allow Edits No
Allow Additions No
Allow Deletions No

Add a command button, and give it these properties:
Name cmdLock
Caption Un&Lock
On Click [Event Procedure]

Click the Build button (...) beside the On Click property.
Access opens the code window.
Paste in the code below.

Private Sub cmdLock_Click()
Dim bAllow As Boolean
bAllow = Not Me.AllowEdits
Me.AllowEdits = bAllow
Me.AllowAdditions = bAllow
Me.AllowDeletions = bAllow
Me.cmdLock.Caption = IIf(bAllow, "&Lock", "Un&Lock")
End Sub

Note that even unbound controls are locked with this code, and so are subforms. If that is undesirable, you can set the Locked property of each control on the form instead.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"emmy128" <emmy128@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C53A16C1-7236-456D-AF10-2F90EC4B269A@xxxxxxxxxxxxxxxx

Im wondering if there is a way to lock the information shown on a form. The
information that shows on my form is from a table, and i want to make it so
that the user cannot edit the names unless they hit the edit button.

so, in essence, i want to make the information un-editable, and, i want to
create a command button that unlocks the info for editing purposes.

because, by default, the information shows up in my combo boxes and text
boxes, if the user doesnt choose to "add a new record" he/she will type over
the existing info....

is this confusing?? if not, please help!!

Cheers



.


Quantcast