smartpat19
Board Regular
- Joined
- Sep 3, 2014
- Messages
- 114
Hi,
I have built a macro that feeds data into an access table from excel. This saves our team lots of time and copy and paste errors. However, the access database has been unreliable and keeps breaking. Do I need to change the way I connect to the access table to improve reliability? Six users will be connecting with the table about 20 times each in one day. See below for the VBA code.
I have built a macro that feeds data into an access table from excel. This saves our team lots of time and copy and paste errors. However, the access database has been unreliable and keeps breaking. Do I need to change the way I connect to the access table to improve reliability? Six users will be connecting with the table about 20 times each in one day. See below for the VBA code.
VBA Code:
Dim db As database
Dim rs As DAO.Recordset
Set db = DAO.OpenDatabase("R:\Development Team Database\Development Team.accdb")
'cost
Set rs = db.OpenRecordset("Monthly Project Cash Flow", dbOpenTable)
Dim thisrow As Long
lastrow = b.Range("M65536").End(xlUp).Row
For thisrow = 2 To lastrow
rs.AddNew
rs.Fields("Report_Name") = b.Range("U" & thisrow).Value
rs.Fields("Project_Number") = b.Range("V" & thisrow).Value
rs.Fields("Cash_Flow_Month") = b.Range("M" & thisrow).Value
rs.Fields("Cost 1") = b.Range("N" & thisrow).Value
rs.Fields("Cost 2") = b.Range("O" & thisrow).Value
rs.Fields("Cost 3") = b.Range("P" & thisrow).Value
rs.Fields("Cost 4") = b.Range("Q" & thisrow).Value
rs.Fields("Cost 5") = b.Range("R" & thisrow).Value
rs.Fields("Cost 6") = b.Range("T" & thisrow).Value
rs.Fields("Cost 7") = b.Range("S" & thisrow).Value
rs.Update
Next thisrow
rs.Close
db.Close