From: Barry A&P on
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

Thank you for your help

Barry
From: Dirk Goldgar on
"Barry A&P" <BarryAP(a)discussions.microsoft.com> wrote in message
news:6C60DDC0-6410-4B0F-8665-54A403C400EC(a)microsoft.com...
> 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)

From: Barry A&P on
Dirk

Thank you for your response...

unfortunately none of the references worked i get the runtime 2455 error
"you entered an expression that has an invalid reference to a form/property"

However this line works fine... Me![F_Parts_Browse_All].Locked = bLock

and as i understand Allen's LockBoundControls module creates its own
references and also locks all controls on all subforms (wich it does on all
of my forms & subforms except this one).

Im completely lost on this one and cant seem to proceed.. could there be
some kind of issue with my form???

Thanks for any more help.

Barry

"Dirk Goldgar" wrote:

> "Barry A&P" <BarryAP(a)discussions.microsoft.com> wrote in message
> news:6C60DDC0-6410-4B0F-8665-54A403C400EC(a)microsoft.com...
> > 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)
>