Results 1 to 6 of 6
  1. #1
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28

    Smile Passing StartDate EndDate from a form to a query

    Hello All,



    I want to select records from a table by a date range. In the query I am using: between [Enter Start Date] and [Enter Ending Date] in the criteria for the date field. The result is two Parameter boxes appear asking for the dates. Is there a way to pass the StartDate and EndDate to the criteria from a combo box. This would eliminate the Parameter boxes.

    Thank you for you help,

    michaelb

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can use the Forms collection to fetch the value.
    Forms.YourOpenFormName.StartDateControlName
    ...using your values of course.

  3. #3
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28
    Thank you for your help.
    I see where Forms.MyOpenFormName.StartDateControlName will work to give me a StartDate. I don't see how to get the EndDate using the same field in the criteria of the query. In the past I used the Between/And so I could enter both. How do get both using a forms collection?


    Thanks


  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about Forms.MyOpenFormName.EndDateControlName

  5. #5
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28
    Thanks again Rural Guy.
    I didnot know that I could use the Forms Collection with the (Between/And) in the criteria. It worked...

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Glad we could help. Are you ready to use the Thread Tools at the top of the thread and mark this thread as Solved?

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

Similar Threads

  1. passing variable from modal form to main form
    By crowegreg in forum Forms
    Replies: 2
    Last Post: 06-03-2011, 05:34 PM
  2. Passing form fields criteria to a Query
    By yosik20 in forum Queries
    Replies: 1
    Last Post: 05-12-2011, 04:24 AM
  3. Passing value from one form to another
    By Molly152 in forum Forms
    Replies: 4
    Last Post: 11-16-2010, 11:03 AM
  4. Passing parameters to a query
    By stephenaa5 in forum Queries
    Replies: 3
    Last Post: 09-10-2010, 05:32 PM
  5. Form not passing data to query
    By bobfin in forum Queries
    Replies: 13
    Last Post: 08-11-2010, 05:28 AM

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