I am using a Data Environment to create a data report. The code is working fine in one app, but after I copy-pasted it to another app, it's giving problem. Both apps are similar and have same references and in same sequence
This works fine (in App # 1)
Dim mFileName As String
mFileName = App.Path & "\IrisRep.mdb"
If DEnv.Conn.State = adStateOpen Then
DEnv.Conn.Close
End If
DEnv.Conn.ConnectionString = "Provider=MSDataShape.1;" & _
"Persist Security Info=False;" & _
"Data Source=" & mFileName & ";" & _
"Data Provider=Microsoft.Jet.OLEDB.4.0"
DEnv.Conn.Open
Internally the Connection string is
Provider=MSDataShape.1;Persist Security Info=False;Data Source=C:\Projects\Iris\IrisRep.mdb;Data Provider=Microsoft.Jet.OLEDB.4.0
In App # 2, it's the same code
Dim mFileName As String
mFileName = App.Path & "\IrisRep.mdb"
If DEnv.Conn.State = adStateOpen Then
DEnv.Conn.Close
End If
DEnv.Conn.ConnectionString = "Provider=MSDataShape.1;" & _
"Persist Security Info=False;" & _
"Data Source=" & mFileName & ";" & _
"Data Provider=Microsoft.Jet.OLEDB.4.0"
DEnv.Conn.Open
Now the connection string is getting changed to
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Projects\WomCollge\IrisRep.mdb;Extended Properties="Data Provider=Microsoft.Jet.OLEDB.4.0";Persist Security Info=False
As you can see, the provider is getting changed and the Extended Properties stuff is coming in. This changes are happening automatically. I found out the connection string by setting a breakpoint and checking in the debug window.
Naturally the connection and report are not coming. I am getting a dialog box to select Jet Ole DB parameters and then a "Could not find Installable ISAM" error
My question is : How do I stop the connection string from getting changed ?