Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2011
    Posts
    31

    Unanswered: Date filtering with macros

    I have a condition from a query that i would like to apply to a raw data table using a macro. The condition within the query for a date field is

    Between ([forms]![RADScreen]![StartDate]) And ([forms]![RADScreen]![EndDate])

    I even copied the SQL for that particular field and tried pasting it into the where condition for 'ApplyFilter', but the results are not filtered between the selected dates from the form.
    SQL:
    (([ALL SAMPLE DATA].BOOKDATE) Between ([forms]![RADScreen]![StartDate]) And ([forms]![RADScreen]![EndDate]))

    Any ideas what i may be doing wrong and how to go around this?

  2. #2
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183
    Set the Filter On Load Property value of the Table to Yes and keep the RADScreen open with the Date-Range values in StartDate and EndDate controls before opening the Table.

    If the Table is the Record Source of RADScreen then the Filter Macro must be assigned to the On Open Event Property. If that is the case then it will not work because after opening the form only you will be able to set the StartDate and EndDate control values.
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

Posting Permissions

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