pulling a date from access database and comparing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hey guys im having trouble with trying to pull a date out of an .mdb access database. the error i am getting is Conversion from string "DD/MM/YYYY" to type Integer is not valid. The date is set out as "19/03/2013" (copy and pasted from db) and the data type in the db is date/time

DBDate = Format(dt1, "DD/MM/YYYY")
sqldate = "SELECT * FROM CustomerDetails WHERE LastEntry = #" & FormatDateTime(Now, "DD/MM/YYYY") & "#"


this is the line im using to try pull it from the database.
additional info:
this is my comparison code Dim dt1 As New Date
dt1 = Date.Now
Dim dt2 As New Date(2013, 3, 13)
Dim Days As Integer = ((dt1.Subtract(dt2)).TotalDays) - 1

MsgBox(Days)

(it works out the difference between the 2 dates)
since im in the UK my PCs system clock runs DD,MM,YYYY not sure if this is important but ill just tell you guys.
anyways thanks for the help

View the full article
 
Back
Top