Click here to Skip to main content
15,888,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Team,

I have cretaed a Tool in MS Access 2007 to generate few reports in Excel.

This tool is running perfectly fine till y'day since last two years.

But Today I have upgrated MS Office 2007 with MS office 2010 (Except Access - So MS Access I have is 2007)

Now when I run my tool MS Access gets hangged and Pop-up comes to Restart the MS Access.

I have investigated/debug cupple of times and found that "CurrentProject.Connection" creating the problem.

I have below code -

VB
Option Compare Database
Option Explicit
 
Sub Test_Proc()
 
Dim cmd As New ADODB.Command
Dim rst As ADODB.Recordset

Set cmd.CommandText= "Select * from Customers"

'On Below Line Aceess gets hannged and pop-up comes for Restart Access
cmd.ActiveConnection = CurrentProject.Connection
Set rst = cmd.Execute
 
End Sub


There might be some DLL conflict issue. But I need to resolve this.

Does anyboday can help me here?

Thanks in Advance!!!
Posted
Updated 11-Feb-15 22:46pm
v4

1 solution

Hi,

Use the code as follows

VB
Dim con As New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & CurrentProject.FullName
con.Open

;;; your code ;;;;

con.Close


Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900