borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Auto Import CSV files into SQL Azure) New Topic New Poll Post Reply
AndreaVB Forum : Off-Topic : Access SQL DateDiff
Poster Message
Shawnturner
Level: Trainee

Registered: 09-11-2017
Posts: 2

icon Access SQL DateDiff

Hi all,

I have the following to get all fields from table tblMain, where the field AuditChecked is more than
one year ago from today.

However I believe my DateDiff part is not formatted correctly, and is therefore not returning values.
The field AuditChecked is a text field in the table, holding a date value. Therefore I have the CDate(AuditChecked)
as part of the SQL statement.

Any tips sincerely appreciated

Dim OneYearAgo As Date
OneYearAgo = DateAdd("yyyy", -1, ((Now)))

NotRecent_SQL = "SELECT IndexID, ATitle, AuditChecked FROM tblMain WHERE Not IsNull([AuditChecked]) AND (DateDiff(""yyyy"", CDate(AuditChecked), " & OneYearAgo & ") >= 1);"

[Edited by admin on 17-11-2017 at 12:32 PM GMT]

____________________________
love travelling

17-11-2017 at 06:58 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Off-Topic : Access SQL DateDiff
Next Topic (Auto Import CSV files into SQL Azure) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
borderAndreaVB free resources for Visual Basic developersborder
borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2017 Andrea Tincaniborder