Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am trying to put the following in a query's criteria:
    [Forms]![frmClientsPolicies]![frmsubPoliciesForThisClient].[Form]![Co].Column(3)
    But I get an error. I guess I am supposed to put more square brackets somewhere, but can't see where.
    The above format returns the correct value in the VBA immediate window but won't work as a query criteria or as a forms filter.
    Regards,
    Peter

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    [quote name='Peter Kinross' post='781373' date='24-Jun-2009 12:00']I am trying to put the following in a query's criteria:
    [Forms]![frmClientsPolicies]![frmsubPoliciesForThisClient].[Form]![Co].Column(3)
    But I get an error. I guess I am supposed to put more square brackets somewhere, but can't see where.
    The above format returns the correct value in the VBA immediate window but won't work as a query criteria or as a forms filter.[/quote]
    When I try to repeat what you are doing I get the same problem. Initially I get an error about Undefined function. If I try to add the parameter to the query's parameters, I get an error about Invalid bracketing.

    However, I have found a workaround.
    On the subform, put a hidden text box, and set its control source to :=[Co].Column(3)
    Then use this text box as the query parameter.
    Regards
    John



  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='johnhutchison' post='781379' date='24-Jun-2009 11:22']When I try to repeat what you are doing I get the same problem. Initially I get an error about Undefined function. If I try to add the parameter to the query's parameters, I get an error about Invalid bracketing.

    However, I have found a workaround.
    On the subform, put a hidden text box, and set its control source to :=[Co].Column(3)
    Then use this text box as the query parameter.[/quote]
    Thanks John. I did this a few hours ago. It solved the immediate problem, but I still don't know why it won't work. It also fails when used as a forms filter criteria.
    Regards,
    Peter

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    [quote name='Peter Kinross' post='781373' date='24-Jun-2009 12:00']I am trying to put the following in a query's criteria:
    [Forms]![frmClientsPolicies]![frmsubPoliciesForThisClient].[Form]![Co].Column(3)
    But I get an error. I guess I am supposed to put more square brackets somewhere, but can't see where.
    The above format returns the correct value in the VBA immediate window but won't work as a query criteria or as a forms filter.[/quote]
    I thought queries could only see controls and not controls columns, and that is why John's solution works.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Pat is correct. Column is a VBA property, you can't use it in a query.

Posting Permissions

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