Results 1 to 3 of 3

Thread: Combobox syntax

  1. #1
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120

    Unanswered: Combobox syntax

    Report named rptGroups(based on qryABC)

    Unbound form named: frmABC
    Combo box named: cboGroupNum
    Row Source Type is Value List
    Row Source is: “Toys123”;”Food123”; “Homes123”; “Clothes123”
    Command button: cmdOpenReport
    (When user clicks the button, the report opens based on
    criteria fed to query by form's combobox.)

    query named qryABC
    The query is based on a table:
    tblGroup
    Code:
    ID#  GROUPNUMBER
    1       Toys123
    2       Food123
    3       Homes123
    4      Shoes123
    5      Hats123
    6      Gloves123
    query field = GroupNumber
    criteria for GroupNumber field is: [Forms]![frmABC]![cboGroupNum]

    When the user selects Toys123,Food123 or Homes123, the report works fine.

    What I am having a problem with, is grouping 3 of the groups as one.
    When the user selects Clothes123, I need the criteria in the query’s GroupNumber field to represent: In (Shoes123,Hats123,Gloves123)
    The boss insists on a combobox (which eliminates the possibilty of a multi select listbox).

    Is there a proper syntax to code what I am trying to do?

    Something to the effect (pseudocode):
    If [Forms]![frmABC]![cboGroupNum] =
    Clothes123 then GroupNumber criteria = In (Shoes123,Hats123,Gloves123) Else GroupNumber criteria = [Forms]![frmABC]![cboGroupNum]

    Thank you for any help you may offer.
    Michael

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if you have your Groups defined in a table, why mess with the value list - a query on your tblGroup will do fine as a row source and make everything easier to maintain.

    how about a second table that holds your GroupOfGroups data

    tblGOG:
    GOGid, auto (PK)
    GOGdescr, text
    GOGmember, lookup to tblGroups

    now your combo needs to look at a query that pulls GroupNumber and GOGid.

    does this make any sense?



    izy

  3. #3
    Join Date
    Mar 2002
    Location
    Sacramento, CA
    Posts
    120
    It makes sense ! Let me work on it and see what happens.

    I'll post back either way.

    Thanks izy!!

    Michael

Posting Permissions

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