Re: Enable/disable controls in subform
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Tue, 13 Dec 2005 10:38:27 +0800
Suggestions:
1. Include the .Form bit:
Me.TripDetail.Form!BundlesProduct1.Enabled = False
Especially with A2003, that helps.
2. If BundlesProduct1 happens to be the ActiveControl of TripDetail.Form,
the attempt to disable it could fail.
3. If the subform has no records (probably the case if the main form is at a
new record), AND no new records can be added, the detail section of the
subform goes completely blank. Referring to the non-existent control in the
subform then generates an error.
Example of when the subform could not add new records:
- Its AllowAdditions property is No.
- The subform is based on a non-updatable query.
- The user does not have permissions to add records.
- The main form was opened with AllowEdits as No, so it does not allow
changes in the subform either.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Brian" <Brian@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8090B5C4-D1BD-43CE-949F-3BEF597437B9@xxxxxxxxxxxxxxxx
>I am getting a non-specified runtime error on Access 2003 runtime only
>(can't
> duplicate on my development station) under this circumstance:
>
> In my Form_Current, I call a sub that enables/disables certain controls
> based on contents of other controls. Some of the controls that I
> enable/disable are on a subform.
>
> It fails on the second line below (ProductID1 is a control on the form,
> TripDetail is the name of the subform, and BundlesProduct1 is a control on
> the subform):
>
> If IsNull(ProductID1) Then
> Me.TripDetail!BundlesProduct1.Enabled = False
> Else
> Me.TripDetail!BundlesProduct1.Enabled = True
> End If
>
> The code runs fine when I open the form, but not after going to a new
> record.
.
- Prev by Date: Re: Getting error 3022 trying to add record
- Next by Date: Re: How to run script in VBA On_Click event
- Previous by thread: Re: Getting error 3022 trying to add record
- Next by thread: Re: Enable/disable controls in subform
- Index(es):
Relevant Pages
|