Results 1 to 3 of 3

Thread: [Resolved] Referencing subforms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    66

    Resolved [Resolved] Referencing subforms

    I have a form called test that contains a subform called header.

    The following is one correct way to reference the form name:

    VB Code:
    1. Forms!test!Header(FieldName) = CombinedDate

    However, I want to reference the form via a variable or direct string as shown below. But neither of these code snippets do NOT work.

    VB Code:
    1. Forms("test.header")(FieldName) = CombinedDate
    or
    VB Code:
    1. dim theName str as string
    2.         theName="test.header"
    3.         Forms(theName)(FieldName) = CombinedDate
    Any ideas on how I might do it or am I missing something?
    Last edited by whiteWay; Jun 22nd, 2006 at 06:49 AM. Reason: resolved

  2. #2
    Member
    Join Date
    Mar 2006
    Posts
    33

    Re: Referencing subforms

    I'm not sure, but I think a subform is considered a control on the main form, so maybe you could try something like this:

    Code:
    Forms("test").Controls("header").Controls("fieldName") = CombinedDate
    then you could replace the hard coded strings with variables if this works. I'll check on it when I get back in to work tomorrow if it isn't already resolved by then.

    -Ranthalion

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    66

    Re: Referencing subforms

    Thanks, you are correct. I ommitted using controls to gain access to that object.

Posting Permissions

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



Click Here to Expand Forum to Full Width