how to translate a code in DAO to ADO
please can you help me, i want to use the ADO, but i have some problem, can you translate me please that code in ADO
Dim db As DAO.Database, rst As DAO.Recordset
Dim SQL As String
Dim date As Date
' open the database
Set db = CurrentDb()
SQL = "SELECT Max(the_date) FROM time_by_day"
' open the recordset
Set rst = db.OpenRecordset(SQL, dbOpenForwardOnly, dbReadOnly)
date_a_ajouter = DateAdd("d", 1, DateValue(rst.Fields(0)))
While DateDiff("d", date_a_ajouter, Now) > 0
SQL = "INSERT INTO time_by_day (the_date,the_month,the_year,day_of_month,week_of_ year,month_of_year,quarter) VALUES('" & date & "','" & MonthName(Month(date)) & "','" & Year(date) & "','" & Day(date) & "','" & DatePart("ww", date) & "','" & DatePart("m", date_a_ajouter) & "','Q" & DatePart("q", date) & "')"
db.Execute SQL
date = DateAdd("d", 1, date)
Wend
' close the Recordset
rst.Close
|