Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
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) & "')"
date = DateAdd("d", 1, date)