Results 1 to 7 of 7
  1. #1
    gregd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    10

    passing values from form to query

    I have a form - RunQuery
    And I have a query - Q2

    The form has text boxes for dates txtStart2, txtEnd2

    On button click I have a macro

    Query Name Q2
    view Datasheet
    datamode edit

    The query will open



    The query has a field Assigned which is Date/Time


    In my query design view I have this as the criteria:
    >[Forms]![RunQuery]![txtStart2] Or <[Forms]![RunQuery]![txtEnd2]


    I also have filter on load set to yes.



    However the filter does not seem to work.

    Any ideas what is missing or wrong?
    thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    What does "does not seem to work" mean exactly? Is the data type of the field in the table date/time? Are the textboxes formatted with a date format? What you have looks like it should work, so I'm trying to figure out why it doesn't. Oh, and are you using a US date format when you enter dates on the form? It should work either way, but it's an area to look at.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    gregd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    10
    Thanks for the response.
    I should have specified that my query does not get filtered with the results.


    Here are some shots.
    You can see my timeframe starts at 3-16-2013. But the result is 3-15-2013
    You can also see the formula. I changed the vars to txtStart and txtEnd


    https://www.accessforums.net/album.p...chmentid=12180

    https://www.accessforums.net/album.p...chmentid=12181

    https://www.accessforums.net/album.p...chmentid=12182

  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,640
    I'm a dork. You want And rather than Or.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    By the way, if you want to include the dates on the form:

    Between [Forms]![RunQuery]![txtStart2] And [Forms]![RunQuery]![txtEnd2]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    gregd is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    10
    thanks,
    I should have caught the or.
    I upped your reputation.
    thanks

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Happy to help. Sadly, I think my reputation is beyond salvaging.
    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: 5
    Last Post: 10-15-2012, 12:18 AM
  2. passing values between forms
    By paulw in forum Access
    Replies: 4
    Last Post: 06-15-2011, 08:52 AM
  3. Replies: 1
    Last Post: 03-24-2010, 08:42 AM
  4. Replies: 3
    Last Post: 06-02-2009, 09:51 AM
  5. Passing Values
    By dromorkid in forum Forms
    Replies: 0
    Last Post: 11-25-2008, 05:04 PM

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