1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Creating a Filter and Adding dates in VBA Access 2010

Discussion in 'Business Applications' started by Dobber9, Dec 21, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. Dobber9

    Dobber9 Thread Starter

    Joined:
    Dec 20, 2011
    Messages:
    11
    I'm working on a filter to show which Drawing Changes are overdue by selecting check boxes that have certain overdue periods. (e.g. 1-14 days past due, 15-30 day past due, 31-60 days, etc.) I'm not very good at VBA but I'm using some code I have from a search form I used a while ago that has a date filter. I'm confident I can figure out the code for the filter, but I'm not sure how to say what I want to happen in VBA code. What I want the filter to read is this:

    If 1-14 days is checked, include entries that (Due Date + 14days) >= Today's date
    If 15-30 days is checked, include (Due Date + 30days) >= Today's date AND (Due date +14days) < Today's date
    and so on.

    I'm using Access 2010 on Windows XP

    Thanks for any help!

    Dobber9
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    You could just subtract the due date from today's date and get a number. Are you looking to do this on a form I assume?
     
  3. Dobber9

    Dobber9 Thread Starter

    Joined:
    Dec 20, 2011
    Messages:
    11
    yeah its a search form with a subform used as the results. When you say, subtract the dates, do you mean that if i just say display entries whose Due date minus today's date < 14, that will work?
     
  4. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Gotcha. You will need to put some logic in there based on which checkbox is ticked and requery the sub form. Is this just to give you some sort of idea when certain things are coming due? You could just create a listbox that sorts them all by the number of days prior to the due date and have them sort in that order.
     
  5. Dobber9

    Dobber9 Thread Starter

    Joined:
    Dec 20, 2011
    Messages:
    11
    It's meant to list out entries that are overdue. I just don't know how to write the code for the filter
     
  6. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Here is a simple way to have them all on one form.
     

    Attached Files:

  7. Dobber9

    Dobber9 Thread Starter

    Joined:
    Dec 20, 2011
    Messages:
    11
    I think that'll work very nicely. Thanks!

    Dobber9
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1032244

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice