Results 1 to 2 of 2

Thread: Dateadd in a SQL statment?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Hi, every body!

    I'm trying to use a dateadd expression in a SQL statment, but I'm having problems cause this function calls for a parameter between double quotes:
    eg.
    dateadd("d", 1, date)

    My SQL is full of dateadd functions (I've brought this SQL from Access, and it works pretty well there)

    Any ideas on how could I get it to work in VB?

    I'll post here a little bit of my SQL, just as an example of what my problem is:

    Set Myset = MyDb.OpenRecordset("SELECT Calibrations.RealDate, Last(IIf(Weekday(IIf([Unit]=1,DateAdd("d",[Value],[RealDate]),IIf([Unit]=2,DateAdd("m",[Value],[RealDate]),IIf([Unit]=3,DateAdd("m",[Value]*12,[RealDate]),"time unexpected")))) _ and so on...

    Thanks in advance for any ideas,
    Roselene

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134

    Post

    I believa data types should allways be between #'s like:

    SQL = "SELECT * WHERE date =#" & date & "#;"

    Hope this helps,

    ------------------
    Jorge Ledo
    [email protected]
    Portugal

    [This message has been edited by JorgeLedo (edited 02-15-2000).]

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