Re: Enable/disable controls in subform

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.


.



Relevant Pages

  • Re: Combo box will not select values
    ... assuming that the name of the subform control is. ... "Rank" combo box on the main form to cboRank, as a field and combo box have ... >> a the rank of the new scout selected) ...
    (microsoft.public.access.modulesdaovba)
  • RE: Child control is changing data on exit, how to stop?
    ... that means the Control Source for the control is ... The subform has Office Name as the link child and master fields. ... Does not position the form to the selected doctor? ... what else do I have to add to get this cbo to filter the subform ...
    (microsoft.public.access.forms)
  • Re: Subform Totals
    ... incompatible with an expression inside a control. ... For each of these fields their is a total field in the form footer. ... form footer of the subform or about the form footer of the main form. ... The questions is why do the total fields in the form footer of the sub ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Lookup record in subform based on combo im main form
    ... The Link Master/Child is set to: ... rather to it's control source. ... buttons on the subform. ... 1 - This is the ID field in the Facilities Table ...
    (microsoft.public.access.formscoding)
  • Re: Lookup record in subform based on combo im main form
    ... rather to it's control source. ... buttons on the subform. ... RowSource: Facilities ... Control Source = EventID -- This is the primary field in the Events ...
    (microsoft.public.access.formscoding)