Results 1 to 4 of 4

Thread: [RESOLVED] Retrieve Dates in MS Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Location
    Philippines - Cavite City
    Posts
    9

    Resolved [RESOLVED] Retrieve Dates in MS Access

    Hello can you please give me an example ... on how can i retrieve a query that only retrieves 2 Monhts old Record..

    Table Name : Part_History
    Field Name : HDate, HPartName and HPartNo

  2. #2
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Retrieve Dates in MS Access

    i think you need to compute for the proper date first before querying it
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  3. #3
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: Retrieve Dates in MS Access

    try this one

    VB Code:
    1. Dim Dat As String
    2. Dat = Format(DateAdd("m", -2, Now), "mm/dd/yy")
    3. "select * from TableName Where DateFieldToBeQuerried = '" & Dat & "'"  'this gets those records that are exactly 2 months old
    4. "select * from TableName Where DateFieldToBeQuerried < '" & Dat & "'"  'this gets those records that are Less than 2 months old
    5. "select * from TableName Where DateFieldToBeQuerried > '" & Dat & "'"  'this gets those records that are greater than 2 months old
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Location
    Philippines - Cavite City
    Posts
    9

    Re: Retrieve Dates in MS Access

    Ei thanks pal it works ...

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