Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011

    Unanswered: Two Combo Boxes for a Date Range + Command Button to run Query

    Hi everyone,
    I use MS Access 2003 and I'm working on a form right now. It is based off a table.

    I have two combo boxes from which you can select dates (based on the table). I want a command button to run a query that will display information from the table between those two dates.

    For example, I would want averages and sums to appear on the form after clicking the command button.

    Is there a way to do this?


  2. #2
    Join Date
    Jun 2011
    Inside your mind
    "SELECT yourTableName.[yourFieldName], ...(repeat as required)... " & _
    "FROM yourTableName " & _
    "WHERE (yourTableName.[YourDateFieldName] " & _
    "BETWEEN #" & format(me.yourComboBoxSTARTDateName.Value, "mm/dd/yyyy") & "# " & _
    "AND #" & format(me.yourComboBoxENDDateName.Value, "mm/dd/yyyy") & "#)"
    You'll need to change the bits in red to the names of your controls, fields and table.

    The Jet engine is picky when it comes to dates, so I've formatted them to the US (correct for Jet) format, as I don't know if that's where you are.
    Looking for the perfect beer...

Posting Permissions

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