Why the sql dont update STATO 'SCADUTO'

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Why the sql dont update STATO 'SCADUTO'

Post by sal21 »

Code: Select all


    OGGI = Format(Date, "DD/MM/YYYY")
    ORA = Format(CDate(Now), "HH.MM")

    SQL = "UPDATE APPUNTAMENTI SET APPUNTAMENTI.STATO = 'SCADUTO' WHERE APPUNTAMENTI.DATA<" & Format(OGGI, "MM/DD/YYYY") & " AND APPUNTAMENTI.ORA<" & Format(ORA, "HH.MM") & " AND APPUNTAMENTI.COMPLETATO IS NULL AND APPUNTAMENTI.CANCELLATO IS NULL"

You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why the sql dont update STATO 'SCADUTO'

Post by HansV »

Don't format twice, and enclose the date and time in #

Code: Select all

    OGGI = Format(Date, "MM/DD/YYYY")
    ORA = Format(CDate(Now), "HH:MM AM/PM")

    SQL = "UPDATE APPUNTAMENTI SET APPUNTAMENTI.STATO = 'SCADUTO' WHERE APPUNTAMENTI.DATA<#" & OGGI & "# AND APPUNTAMENTI.ORA<#" & ORA & "# AND APPUNTAMENTI.COMPLETATO IS NULL AND APPUNTAMENTI.CANCELLATO IS NULL"
Best wishes,
Hans