Results 1 to 4 of 4
  1. #1
    Kraig is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    2

    Using a form to query table


    So to preface, I am a complete novice at manipulating forms, etc. in a database, nor do I have programming knowledge (I know, oh boy).

    I am trying to build a form to filter a query in access 2010. The query is created from several linked tables. I have figured out some simple basics, such as using query criteria (Like "*" & [Forms]![SearchTest]![ChangeType] & "*") to control the query.

    There are a few things I want to do, that I think are a little more complex and I am having trouble figuring out.

    One is that I have a project field that I want to filter from. If I keep it simple and use the criteria shown above, no problem, but I can't figure out how to filter from several (or all) projects in that field.
    For example: The " projects" field are locations in my database table. So I might have several thousand records that the project field is "Missouri", several thousand that are "Tennessee", so on and so forth. Using the criteria above (Like "*" & [Forms]![SearchTest]![ChangeType] & "*"), and only allowing input of one project works great, but if I have to run a query including several of my projects, I'm lost.

    Also, while I'm asking, I also have a "last modified" date field that I have put begin date and end date text boxes on my form for the user to search for records between those to dates using the following criteria in the query: Between [Forms]![SearchTest]![BeginDate] And [Forms]![SearchTest]![EndDate]. That works as well as long as dates are entered into the form. I would like the query to still run if there are no dates entered, in case the "last modified" date field from the table is blank.

    I have been searching forums and googling this issue for the past several hours and I think I've gotten myself lost.

    I have no idea if I've given enough information for any kind of answer to my questions or not. Please let me know if I need to expand on my request.

    Thank you,
    Kraig

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    How many separate projects do you have?


    Sent from my iPhone using Tapatalk

  3. #3
    Kraig is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    2
    Quote Originally Posted by andy49 View Post
    How many separate projects do you have?


    Sent from my iPhone using Tapatalk
    There are 44 projects.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    One way of allowing the selection of one or more projects:

    http://www.baldyweb.com/multiselect.htm

    I'd handle all by not filtering if the user didn't choose anything.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 08-05-2016, 10:57 PM
  2. Replies: 2
    Last Post: 07-07-2016, 07:01 PM
  3. Replies: 0
    Last Post: 06-03-2014, 05:15 AM
  4. Replies: 1
    Last Post: 07-26-2012, 10:51 AM
  5. Replies: 0
    Last Post: 02-24-2010, 12:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums