lock main form unlock subform

D

Di

I have used the suggestion found in the forum to build an lock/unlock button
on my main form to stop accidental editing. This worked a treat but of
course changing the settings of Allow Edits to No has locked my subform.

Is there a simple way to have the subform available but keep the edit lock
on the main form?
 
A

Allen Browne

If you are using the code in this article:
http://allenbrowne.com/ser-56.htm
you can just include the name of the subform control in the exception list.

For example, when you open your main form in design view, if the subform is
named Child1, you coulse use:
Call LockBoundControls(Me, bLock. "Child1")
 
D

Douglas J. Steele

Add an l to the end of that: http://www.allenbrowne.com/ser-56.html

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jubiiab via AccessMonster.com said:
Hi Allen

Your link is not working.

Allen said:
If you are using the code in this article:
http://allenbrowne.com/ser-56.htm
you can just include the name of the subform control in the exception
list.

For example, when you open your main form in design view, if the subform
is
named Child1, you coulse use:
Call LockBoundControls(Me, bLock. "Child1")
I have used the suggestion found in the forum to build an lock/unlock
button
[quoted text clipped - 3 lines]
Is there a simple way to have the subform available but keep the edit
lock
on the main form?
 
D

Di

Hi Allen
yes it was your code I used, when you say the exception list in design view,
does that come under properties? Excuse my ignorance, learning as I go here!

thanks in anticipation. Di
 
D

Di

Help - what am I doing worng??

Private Sub cmdLock_Click()
Dim bAllow As Boolean
bAllow = Not Me.AllowEdits
Me.AllowEdits = bAllow
Me.AllowAdditions = bAllow
Me.AllowDeletions = bAllow
Call LockBoundControls(Me,bLock."InterventionsOrg")
End Sub
 
D

Douglas J. Steele

It would help to know what error you're getting...

Looking at the last line in your sub, you appear to have a period rather
than a comma between the second and third parameters. Try

Call LockBoundControls(Me,bLock,"InterventionsOrg")
 
A

Allen Browne

Open the main form in design view.
Right-click the edge of the subform control, and choose Properties.
On the Other tab of the Properties sheet, what is the Name of the subform
control?

It may not be the same as the name of the form you load into it (i.e. its
SourceObject.)
 

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