"Data provider could not be initialized"
The debugger sends me to the "Set conn = CurrentProject.AccessConnection" in the code below which I searched help for and found that current project is one of the properties in Access 2007 that is blocked by sandbox mode. So I followed the instructions and changed the sandbox number in the registry from 3 to 2, but still the same error. I also made sure to add the file path to the trusted locations. I might be leading down the wrong path altogether, but this works on other machines and not mine making me think it is a security setting.
Anyhow, any help would be much appreciated.
Expand|Select|Wrap|Line Numbers
- Dim rs As DAO.Recordset, rs1 As DAO.Recordset
- Set rs = CurrentDb.OpenRecordset("SELECT count(litter), litter, pad_name FROM tpl_Efficiency_Output GROUP BY pad_name, litter")
- Dim exeStr As String
- Dim conn As New ADODB.Connection
- Set conn = CurrentProject.AccessConnection
- Do Until rs.EOF
- If rs(0) <= 2 Then
- If rs(1) > 1 Then
- exeStr = "update tpl_Efficiency_Output set Litter="
- exeStr = exeStr & rs(1) - 1
- exeStr = exeStr & " where pad_name="
- exeStr = exeStr & "'" & rs(2) & "'"
- exeStr = exeStr & " and Litter=" & rs(1)
- conn.Execute (exeStr)
- End If
- End If
- rs.MoveNext
- Loop
- rs.Close
- End Sub