We help IT Professionals succeed at work.

data provider could not be initialized

Last Modified: 2013-11-28
I've been having problems in Access 2003, which I use as front-end connection to a SQL 2005 server, with the following error message  - "Data provider could not be initialized". The message pops up every  few hours. I tried to catch it On Error events in all forms in my project, and sequentially suppress it.  This did not work, I mean, the error is not caught on this event.

I also tried to tune up SQL server settings connected to a new feature in SQL 2005 to poll, discover, and clean up disconnected sessions (http://social.msdn.microsoft.com/forums/en-US/sqldataaccess/thread/47d2df0a-0f32-41f8-a5b2-6d8d656d3271/ ). Although It seems that I receive now  fewer error messages, it did not solve the problem. Two other threads here were not helpful:
Watch Question

maybe is a MDAC issue...try to reinstall it
so I read the second answer, it seems that has to do with permissions ... try it too, check the permissions in the database


No,... the application works correctly all of the time, I have access to all db resources I need. The pop-up message suddenly pops up after a long inactivity period, usually more than one hour. So, it could not be any permission/security or MDAC issue. The user that access the MS SQL is granted  dbo permissions on the database.  It could not be also an  IIS issue, for I do not use it. I use direct  ADO connection to DB  im my VBA code.  Sample code is
Set conn = New ADODB.Connection
    conn.ConnectionString = "some valid connection string"
    Set cmd = New ADODB.Command
With cmd
   .ActiveConnection = conn
   .CommandTimeout = 5
   .CommandText = strCommandText
   .CommandType = adCmdStoredProc
End With

Set rst = New ADODB.Recordset
    rst.Open cmd
If Not rst.State = adStateClosed Then
   If Not rst.EOF Then
    Retval = rst.GetString(adClipString, , DELIM, DELIM)
   End If
End If


Now I am trying to use "Launch Depends..." of Sysinternals Process Explorer, to try to find out where this message is thrown. As I said, it is not caught at "OnError" or "OnCurrent" event in any form in my project.
I'll post if I find something interesting there...


First of all, the error message is 100% reproducible by choosing the "refresh" item of the "records" menu of Access Menu bar. it has no apparent consequence, for after its appearing, the application works as fine as it should.
It was not possible to catch the message neither at OnError event of the Form not at OnCurrent.

OK, I tried to bind the main form of my project to just a regular Access table, instead of ADO recordset. As a result, the error message ("data provider coudl not  be initialized") was incurred as many times as it takes of refreshing the each and every subform of my main form!  Instead of appearing once, I had 13 uch appearances when choosing the "refresh".

So, I rebound the main form back to its ADO recordset. Now, I again receive the message only once, when I choose the "refresh" item of the "Records" menu.

If someone now what event fires up on clicking the "refresh" item of the "records" menu, this will probably solve this very strange problem..


I did the following experiment - I run the application within a VMware Player box. VMWare Player has a very interesting feature - when you restore it from a minimized state, or just click within, it does not incur any repaint or screen refresh events in MS Access applications. And, as a result, no "Data provider...." message ever appears after an inactivity period. Only if I specifically choose "Records" -> "Refresh" menu item, it happens, but it seems to be not a problem, becuae no one will need to do it on purpose.
Quite a strange "solution"... Doe anyone know how to mimic this behavior (skip all repaint events)  in regular, not virtualized, evnvironment??
Unlock this solution and get a sample of our free trial.
(No credit card required)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.