Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Overlooking parameters on form

Discussion in 'Information Technology' started by dsnyder, Jul 28, 2006.

  1. dsnyder

    dsnyder
    Expand Collapse
    Guest

    Hello All,

    I have a form that has four fields on it. These fields have combo
    buttons on them and after the user has selected their options they
    click a button and it runs a query and pulls up their selected fields.


    My problem is that the user is not always going to remember what all
    the fields may be. So I need to figure out a way that if they leave
    the combobox blank that it will just overlook it and pick up the 3
    other fields.

    I don't know if it might be a "Like" value that I should put in the
    query criteria or what? If anyone has any ideas please let me know.
    Any help would be appreciated

    Thank you for your time

    -Will
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    It is possible to build the WHERE clause of the query so it returns all
    records when the combo is null, e.g.:
    WHERE ([Forms].[Form1].[Combo1] Is Null
    OR [SomeField] = [Forms].[Form1].[Combo1])
    AND ([Forms].[Form1].[Combo2] Is Null
    OR [AnotherField] = [Forms].[Form1].[Combo2])
    AND ([Forms].[Form1].[Combo3] Is Null
    OR [Field3] = [Forms].[Form1].[Combo3])

    A more efficient solution would be to use only those controls that have a
    value. You can do this if you are building the Filter string for a form, or
    the WhereCondition for OpenReport, or building a SQL statement to use in
    code or to apply to the SQL property of a QueryDef.

    For an example of that approach, download this little sample database for
    Access 2000 and later:
    http://allenbrowne.com/unlinked/Search2000.zip

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "dsnyder" <wsnyder3@mail.fscwv.edu> wrote in message
    news:1151336408.823662.264750@p79g2000cwp.googlegroups.com...
    >
    > I have a form that has four fields on it. These fields have combo
    > buttons on them and after the user has selected their options they
    > click a button and it runs a query and pulls up their selected fields.
    >
    >
    > My problem is that the user is not always going to remember what all
    > the fields may be. So I need to figure out a way that if they leave
    > the combobox blank that it will just overlook it and pick up the 3
    > other fields.
    >
    > I don't know if it might be a "Like" value that I should put in the
    > query criteria or what? If anyone has any ideas please let me know.
    > Any help would be appreciated
     

Share This Page