smartpat19
Board Regular
- Joined
- Sep 3, 2014
- Messages
- 114
I have the current macro (Code below) that adds one record to an access database which works great. How do I create a loop that would insert all 500 rows and stops at the next blank cell?
Or is there another option I should be looking at to insert multiple rows into access?
Thank you
Or is there another option I should be looking at to insert multiple rows into access?
Code:
Sub Add_Record()
Application.ScreenUpdating = False
Dim db As database
Dim rs As DAO.Recordset
Set db = DAO.OpenDatabase("M:\Access\Development Team.accdb")
Set rs = db.OpenRecordset("Cost Schedule", dbOpenTable)
rs.AddNew
rs.Fields("Report_Name") = Range("A2").Value
rs.Fields("Project_Number") = Range("B2").Value
rs.Fields("Cost Month") = Range("C2").Value
rs.Fields("Acquisition Cost") = Range("D2").Value
rs.Fields("Hard Cost") = Range("E2").Value
rs.Update
rs.Close
db.Close
Application.ScreenUpdating = True
End Sub
Thank you