Data environment designer problem 
Author Message
 Data environment designer problem


How can I provide the connection string to the data environment designer
without getting a prompt first???

I have a VB project with a connection to an Access 2000 db in the Data
Environment designer. Works fine.
Before distributing the project, I would like to make sure the application
can handle a changing database path.

I have a procedure that looks for the database path in an .ini file. It lets
the user select a database if no correct path is found and shuts down the
application if no database can be bound to the application.

Major problems implementing this: I have cleared the database path in the
database designer (the connection property that is left is
"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False"). So when
running the project, it looks for a provider and database BEFORE the form
load, so I can't use that to set the connection. I guess I need the
WillConnect event of the connection to set the database path. When I put:

Private Sub cnnCodeLib_WillConnect(ConnectionString As String, UserID As
String, Password As String, Options As Long, adStatus As
ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection)

    ConnectionString = gsHandleConnection

End Sub

"gsHandleConnection" will insert "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & dbPath & ";Persist Security Info=False".

I STILL get a prompt for the data source (Ms Jet OLE DB initialisation

Help greatly appreciated.


Wed, 23 Jun 2004 03:16:01 GMT  
 Data environment designer problem
You should be able to reset the connection string used by the Data
Environment in its "initialize" event, using syntax similar to the

DataEnvironment1.Connection1.ConnectionString =
"provider=microsoft.jet.oledb.4.0;data source=c:\YourPath\Yourdb.mdb;"

This will override the one stored at design time.

Hope this helps!

Steven Bras, MCSD
Microsoft Developer Support/Visual Basic WebData

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit

Sat, 26 Jun 2004 04:47:57 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Data Report Designer and Data Environment Problem

2. Any problems with the Data Environment Designer?

3. problem with child command in data environment designer

4. data report / data environment designers

5. data report / data environment designers

6. Data Report Designer and Data Environment

7. Data Environment Designer

8. Data Environment Designer

9. Data Environment Designer

10. Error when using Data Environment Designer

11. Data environment designer

12. Data Environment Designer - User Controls


Powered by phpBB® Forum Software