P
pietlinden
I must be doing something stupid, and I can't figure out what it is.
I'm working with Keri Hardwick's article here:
http://www.mvps.org/access/forms/frm0031.htm
I have a checkbox on my main form, "chkHasSites", and a subform on a
tabbed control on my main form has a subform called "Metastatic
Disease Sites" (Yes, I know it shouldn't have spaces!) What I want to
do when the chkHasSites is false is disable entering new records into
the subform "Metastatic Disease Sites".
When I try this:
Private Sub ToggleSubform()
' If a patient has Metastatic Disease Sites, the checkbox should
be checked.
' in order to add MDSs, you need to CHECK the checkbox. If the box
is not checked, disable the subform
Forms![frmPatient]![Metastatic Disease Sites].Form![Metastatic
Disease Site].Enabled = Me.chkHasSites
Forms![frmPatient]![Metastatic Disease Sites].Form![Metastatic
Disease Site].Locked = Not Me.chkHasSites
End Sub
I get Error 2164, "You can't disable a control while it has focus".
If I do the obvious and do
me.Controls("SomeOtherControl").SetFocus
and then try it, it still fails. So what am I missing and how do i
fix it?
If you need more info - ask! (I think I got it all, but I've thought
that before...)
Thanks!
Pieter
I'm working with Keri Hardwick's article here:
http://www.mvps.org/access/forms/frm0031.htm
I have a checkbox on my main form, "chkHasSites", and a subform on a
tabbed control on my main form has a subform called "Metastatic
Disease Sites" (Yes, I know it shouldn't have spaces!) What I want to
do when the chkHasSites is false is disable entering new records into
the subform "Metastatic Disease Sites".
When I try this:
Private Sub ToggleSubform()
' If a patient has Metastatic Disease Sites, the checkbox should
be checked.
' in order to add MDSs, you need to CHECK the checkbox. If the box
is not checked, disable the subform
Forms![frmPatient]![Metastatic Disease Sites].Form![Metastatic
Disease Site].Enabled = Me.chkHasSites
Forms![frmPatient]![Metastatic Disease Sites].Form![Metastatic
Disease Site].Locked = Not Me.chkHasSites
End Sub
I get Error 2164, "You can't disable a control while it has focus".
If I do the obvious and do
me.Controls("SomeOtherControl").SetFocus
and then try it, it still fails. So what am I missing and how do i
fix it?
If you need more info - ask! (I think I got it all, but I've thought
that before...)
Thanks!
Pieter