"Barry A&P" <(E-Mail Removed)> wrote in message
news:6C60DDC0-6410-4B0F-8665-(E-Mail Removed)...
> Because i cant get allen brownes "LockBoundControls" to work with this
> form.
> (although it works wonderfully for me in many other instances) I would
> like
> to disable the record selectors or possibly the allow additions to prevent
> copying and pasting a new record to a locked form wich then locks access
> because of a index violation wich cant be fixed because the form is
> locked..
> after trying to close the form 10 times a message is finally displayed
> that
> says the record can not be saved and the form closes..
>
> Please see the code below
> this line works fine.. Me![F_Parts_Browse_All].Locked = bLock
> however all of the others give me a runtime error 438 (object does not
> support this property or method.. i feel like i have tried every reference
> in
> the book
>
> Private Sub cmdLock_Click()
> Dim bLock As Boolean
> bLock = IIf(Me.cmdLock.Caption = "&Lock", True, False)
>
> If bLock = True Then
> Me!cmdLock.Caption = "Un&Lock"
> Else
> Me!cmdLock.Caption = "&Lock"
> End If
>
> 'Me.F_Parts_Browse_All.Description.Enabled = Not bLock
> 'Me![F_Parts_Browse_All].AllowAdditions = False
> Me![F_Parts_Browse_All].Locked = bLock
> 'Me![F_Parts_Browse_All]!Properties.RecordSelectors.Visible = bLock
> 'Me![F_Parts_Browse_All].AllowEdits = Not bLock
>
> End Sub
You're making the mistake of trying to manipulate properties of the subform
*control* (on the main form), rather than the properties of the form object
that control displays. Try this.
Me.F_Parts_Browse_All.Form!Description.Enabled = Not bLock
Me![F_Parts_Browse_All].Form.AllowAdditions = False
Me![F_Parts_Browse_All].Locked = bLock
Me![F_Parts_Browse_All].Form.RecordSelectors = Not bLock
Me![F_Parts_Browse_All].Form.AllowEdits = Not bLock
If you weren't able to get Allen's LockBoundControls to work on this
form/subform, maybe you were having a similar problem with that code --
trying to run it against the subform control rather than the subform
control's .Form object.
--
Dirk Goldgar, MS Access MVP
Access tips:
www.datagnostics.com/tips.html
(please reply to the newsgroup)