Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    how to refer to subform (Access 2000)

    How shall i refer to the subform? I set the DefaultValue in the main form as follows:
    Me!afid.Value = Me!office
    However i also want to set the default value to the subform:
    Me![Call Listing Subform].DefaultValue = Me![office]
    but i get the message that object doesnt support this method.

    Which is the proper way to refer to the subform?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: how to refer to subform (Access 2000)

    You can set the default value for a control on the subform, but it doesn't make sense to set the default value for the subform itself. Where would the value go? If the subform contains a control named afid, you can use

    Me![Call Listing Subform]!afid.DefaultValue = Me![office]

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 41 Times in 40 Posts

    Re: how to refer to subform (Access 2000)

    While Hans' reponse it technically correct, it might help you if you looked at the full syntax required to specify a control on a subform. In your case, assuming [Call Listing Subform] was the actual name of the subform control and [afid] was the name of the control on the form contained by the subform control, then the full syntax would be:
    Me.[Call Listing Subform].form![afid].DefaultValue = me!Office

    The .form property is the default property of the subform control, so you don't have to specify it. However, I personally always include it as I think it makes the code easier to read later.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts