Results 1 to 3 of 3

Thread: Subform values

  1. #1

    Subform values

    I am attempting to pass a value from a subform into a SQL stmt to populate the parent form. I started with:

    myvalue = forms![parentform]![subform]!control.column(x,y)

    sSQL = bla + bla + myvalue

    I know everything works except I am receiving an invalid property error message. I don't get it, because when I am in the code for the subform I can get the value. When I move out to the parent form I don't get the value. I am sure that it works in Access97 but I am using Access 2000.

    Any thoughts??

    AJG <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

  2. #2

    Re: Subform values

    ahhhh - Never mind.
    In Access 2000 subforms are entities in themselves. So ...

    myvalue = forms![parentform]![subform]!control.column(x,y)

    Should be:

    myvalue = forms![parentform]![subform].form.control.column(x,y)

    Hows that!!!

    Thanks for all your help!!!

    AJG <img src=/S/doh.gif border=0 alt=doh width=15 height=15>

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Subform values

    That isn't new to Access 2000. The problem is that the subform control on the parent form doesn't actually represent the subform, it's merely a container for it. So if you need to reference a control on the subform, it's often safest to specify the .Form method to get to the actual subform and its controls collection. This is especially true if you're referencing it from outside the parent form.

    It would be perfectly OK to write this as well:

    myvalue = forms![parentform]![subform].form!control.column(x,y)

Posting Permissions

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