Results 1 to 2 of 2

Thread: Query Error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2005
    Location
    INDIA
    Posts
    65

    Query Error

    Dear Friends,
    I am making a program,which requires the connection string query to return the dates... to the recordset
    VB Code:
    1. rst.open "Select * from table1 where dates>= " & dateadd("d",-val(combo1.text),now),conn,

    Here dates is of DateTime Data type in MS Access which stores dates in table1.
    combo1.text is numerical....


    Actually i want to get the data for all the dates in the table,before combo1.text days from now...

    HELP ME,

    Thanks
    "What we are is not decided by our qualities,
    What we are is decided by our decisions"
    -Albus Dumbledore
    harry potter and the chamber of secrets

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Query Error

    Dates for MS Access need to be delimited by the # sign.

    When converting dates to a string for this purpose, the date should be formatted to mm/dd/yyyy otherwise there will be problems on systems
    which use other date formats.

    VB Code:
    1. rst.open "Select * from table1 where dates>= #" & Format$(dateadd("d",-val(combo1.text),now), "mm/dd/yyyy") & "#",conn,

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