473,500 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data provider could not be initialized error help

1 New Member
I am trying to debug a VBA program in Access and have no idea what I am doing, but when I execute the code I get the following error:
"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
  1. Dim rs As DAO.Recordset, rs1 As DAO.Recordset
  2. Set rs = CurrentDb.OpenRecordset("SELECT count(litter), litter, pad_name FROM tpl_Efficiency_Output GROUP BY pad_name, litter")
  3. Dim exeStr As String
  4. Dim conn As New ADODB.Connection
  5. Set conn = CurrentProject.AccessConnection
  6.  
  7. Do Until rs.EOF
  8.     If rs(0) <= 2 Then
  9.         If rs(1) > 1 Then
  10.             exeStr = "update tpl_Efficiency_Output set Litter="
  11.             exeStr = exeStr & rs(1) - 1
  12.             exeStr = exeStr & "  where pad_name="
  13.             exeStr = exeStr & "'" & rs(2) & "'"
  14.             exeStr = exeStr & " and Litter=" & rs(1)
  15.             conn.Execute (exeStr)
  16.         End If
  17.     End If
  18.     rs.MoveNext
  19. Loop
  20. rs.Close
  21.  
  22. End Sub
Jul 13 '10 #1
1 5700
MikeTheBike
639 Recognized Expert Contributor
@JulieV
Hi

Have you tried this instead

Set conn = CurrentProject.Connection

I assume this hasn't changed in Access 2007

??

MTB
Jul 14 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3728
by: Marsha | last post by:
Does anyone know how to add a new data provider to Visual Studio - to the Provider list in Server Explorer. I am using Sybase's ADO.NET Data Provider. It has been added to my GAC and appears in...
2
5607
by: rufus | last post by:
Hi, My vb.Net program is copy files from one network location to another, because these are quite large files it takes hrs and i keep getting a timeout expired error message from the the data...
10
2167
by: Paul Deibel | last post by:
Hello I am working on a VB.Net project where I need to change the data provider from OLEDB to OracleClient. I am also looking to use "shaping" and I am looking for the equivalent to...
0
1654
by: acwomble | last post by:
I am working with a database on another system via a ssh tunnel using plink. We have setup an alias the local system for the remote database. I am able to connect and work from within Visual...
2
8108
by: Andrew | last post by:
Win2k3 IIS6 ..NET 2.0 In my ASP.NET 2.0 app I create an open an SQL connection in the page's constructor and call objSQL.Dispose() in the destructor. The SQLConnection object is a class...
6
1172
by: Bonzol | last post by:
Can someone tell me why I get this error "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll" when i do this Private Sub btnAdd_Click(ByVal sender...
1
5161
by: John Bailo | last post by:
I'm doing a profile on my SQL Server to see if I can eliminate any long running statements, and periodically, I see an entry for ".NET SqlClient Data Provider". The durations for it are very...
2
13740
by: Bob | last post by:
I'm running sql server ver 7.0 SP4. I have an access project (.adp) that runs a view which is nothing more than a select statement. Access locks up solid when I try to run this query - with NO...
2
6081
by: Klaudiusz Bryja | last post by:
Hi I connect to Oracle 9.2 using System.Data.OracleClient. I call stored procedures and in cmd.ExecuteNonQuery I get error: "Internal .Net Framework Data Provider Error 30." StackTrace: in...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.