By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

help!cannot lock the subform

P: n/a
there is a form "order" which includes a subform "order_detail", and a
checkbox called "save" in the form "order".

what I want to do is when I click "save", the "order_detail" subform will be
locked, I mean the data inside "order_detail" thus can not be edited.

here goes the code:

------------------------------------------

Private Sub Form_Current()

If Me.save.Value = True Then

Me.AllowDeletions = False
Me.AllowEdits = False

Me.[order_detail].Locked = True

Else

Me.AllowDeletions = True
Me.AllowEdits = True

Me.[order_detail].Locked = False

End If

End Sub

------------------------------------

but it does not work with the "order_detail" subform, after I click the save
checkbox, I can still edit the data inside the order_detail subform.

why?

please help,

thanks in advance.

Paul
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Paul you must reference your subform differently. There's great info here
http://www.mvps.org/access/forms/frm0031.htm detailing how to reference
controls on forms etc. Here's how you need to reference your subform:

(Air Code)
Private Sub Form_Current()
If Me.save.Value = True Then
Me.AllowDeletions = False
Me.AllowEdits = False
Me.order_detail.Form.AllowDeletions = False
Me.order_detail.Form.AllowDeletions = False
Else
Me.AllowDeletions = True
Me.AllowEdits = True
Me.order_detail.Form.AllowDeletions = True
Me.order_detail.Form.AllowDeletions = True
End If
End Sub
--
Reggie

----------
"Paul T. Rong" <et***@hotmail.com> wrote in message
news:yT*****************@news.chello.at...
there is a form "order" which includes a subform "order_detail", and a
checkbox called "save" in the form "order".

what I want to do is when I click "save", the "order_detail" subform will be locked, I mean the data inside "order_detail" thus can not be edited.

here goes the code:

------------------------------------------

Private Sub Form_Current()

If Me.save.Value = True Then

Me.AllowDeletions = False
Me.AllowEdits = False

Me.[order_detail].Locked = True

Else

Me.AllowDeletions = True
Me.AllowEdits = True

Me.[order_detail].Locked = False

End If

End Sub

------------------------------------

but it does not work with the "order_detail" subform, after I click the save checkbox, I can still edit the data inside the order_detail subform.

why?

please help,

thanks in advance.

Paul

Nov 13 '05 #2

P: n/a
Reggie found the great info in www.mvps.org will tell you if it works this
time.

thank you,

Paul

"Reggie" <No**********@NoSpamsmittysinet.com> 写入消息新闻
:o4********************@comcast.com...
Paul you must reference your subform differently. There's great info here
http://www.mvps.org/access/forms/frm0031.htm detailing how to reference
controls on forms etc. Here's how you need to reference your subform:

(Air Code)
Private Sub Form_Current()
If Me.save.Value = True Then
Me.AllowDeletions = False
Me.AllowEdits = False
Me.order_detail.Form.AllowDeletions = False
Me.order_detail.Form.AllowDeletions = False
Else
Me.AllowDeletions = True
Me.AllowEdits = True
Me.order_detail.Form.AllowDeletions = True
Me.order_detail.Form.AllowDeletions = True
End If
End Sub
--
Reggie

----------
"Paul T. Rong" <et***@hotmail.com> wrote in message
news:yT*****************@news.chello.at...
there is a form "order" which includes a subform "order_detail", and a
checkbox called "save" in the form "order".

what I want to do is when I click "save", the "order_detail" subform
will be
locked, I mean the data inside "order_detail" thus can not be edited.

here goes the code:

------------------------------------------

Private Sub Form_Current()

If Me.save.Value = True Then

Me.AllowDeletions = False
Me.AllowEdits = False

Me.[order_detail].Locked = True

Else

Me.AllowDeletions = True
Me.AllowEdits = True

Me.[order_detail].Locked = False

End If

End Sub

------------------------------------

but it does not work with the "order_detail" subform, after I click the

save
checkbox, I can still edit the data inside the order_detail subform.

why?

please help,

thanks in advance.

Paul


Nov 13 '05 #3

P: n/a
reggie, it works, thanks!

Paul

"Paul T. Rong" <et***@hotmail.com> 写入消息新闻
:Z7******************@news.chello.at...
Reggie found the great info in www.mvps.org will tell you if it works this
time.

thank you,

Paul

"Reggie" <No**********@NoSpamsmittysinet.com> 写入消息新闻
:o4********************@comcast.com...
Paul you must reference your subform differently. There's great info here http://www.mvps.org/access/forms/frm0031.htm detailing how to reference
controls on forms etc. Here's how you need to reference your subform:

(Air Code)
Private Sub Form_Current()
If Me.save.Value = True Then
Me.AllowDeletions = False
Me.AllowEdits = False
Me.order_detail.Form.AllowDeletions = False
Me.order_detail.Form.AllowDeletions = False
Else
Me.AllowDeletions = True
Me.AllowEdits = True
Me.order_detail.Form.AllowDeletions = True
Me.order_detail.Form.AllowDeletions = True
End If
End Sub
--
Reggie

----------
"Paul T. Rong" <et***@hotmail.com> wrote in message
news:yT*****************@news.chello.at...
there is a form "order" which includes a subform "order_detail", and a
checkbox called "save" in the form "order".

what I want to do is when I click "save", the "order_detail" subform will
be
locked, I mean the data inside "order_detail" thus can not be edited.

here goes the code:

------------------------------------------

Private Sub Form_Current()

If Me.save.Value = True Then

Me.AllowDeletions = False
Me.AllowEdits = False

Me.[order_detail].Locked = True

Else

Me.AllowDeletions = True
Me.AllowEdits = True

Me.[order_detail].Locked = False

End If

End Sub

------------------------------------

but it does not work with the "order_detail" subform, after I click

the save
checkbox, I can still edit the data inside the order_detail subform.

why?

please help,

thanks in advance.

Paul



Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.