CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Help

  1. #1
    Join Date
    May 2011
    Posts
    2

    Help

    So I am new to database reasoning, and my work currently wants to implement Access 2007. I'm stuck though. I'm trying to create a macro for a table so that the table will display all dates from 9 months and prior. Does anyone know how to write this code!?!?!

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Help

    You will want to create a select query and use a where clause to filter the data. Access has a wizard to help with this, a wysiwyg and the ability to type in sql directly to create the query. What you would need assuming the date is in an actual date field is something like

    Select * from MyTable where TransDate<=#TargetDate#;
    Where TargetDate is the cut off date

    You can also do

    Select * from MyTable where TransDate<=#[Enter Date]#;

    To prompt the user for the date to use.


    Both queries will return all columns of all rows which match the date criteria.
    Last edited by DataMiser; May 13th, 2011 at 10:53 PM.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Help

    A macro implies VBA, rather than VB6. The code that you use for the query is the same, though
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured