Limit Combo Box results by date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slenish
    Contributor
    • Feb 2010
    • 283

    Limit Combo Box results by date

    Hello all,

    I am trying to make it so a combo box will only display records of the last 5 days worth of information from the drop down.

    Currently I have the drop down using a query that I have creating the results on open using

    Code:
    between now() and now() - 5 'date criteria
    but im trying to filter threw about 300,000 records so its really slow! Is there a way I could rebuild this feature with VBA to greatly increase the speed??

    Thanks for the help :D
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Well a few things:
    1. Add an index to the date field in your table
    2. Changed your function to read >Date-5

    Of course option 2 is counting on you not having future dates as part of your record. It basicly saves you a comparison. Also, Date will only use the date whereas Now will be both date and time.

    There are more advanced options that can be used, but I would start with these 2 simple things, before startind coding solutions.

    Comment

    Working...