Click to See Complete Forum and Search --> : Which is the right reference for a Database object?


Dr_Michael
December 16th, 1999, 09:29 AM
I want to set an object as Database:

Dim db as Database



Which is the Refernce that I must set in order to satisfy this?

Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece

santulan
December 16th, 1999, 09:34 AM
Hi,

Please check on Microsoft DAO 3.51 Object Library.



Santulan

Dr_Michael
December 16th, 1999, 09:42 AM
I already use ADO 2.0. Doesn't it support it? Am I enforced to use DAO?

Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece

santulan
December 16th, 1999, 09:51 AM
Well, I have not used ADO so far but to use database I always use DAO.

I just think that with ADO you use ADODB or Connection.




Santulan

whg
December 16th, 1999, 08:20 PM
I have been useing this approach, but if you have a better one let me know..

Database SQL 6.5


'//
PROVIDERTIMEOUT=100 ' Really slow app.
ADOProvider = "SQLOLEDB"


DB_ENV = ";Server=" & DSNAME & ";Uid=" & DSN_UID & ";Pwd=" & DSN_PWD & ";Database=" & DSN_DB
OBWebDB.CommandTimeout = PROVIDERTIMEOUT
OBWebDB.Provider = ADOProvider
OBWebDB.Open DB_ENV


whg

Dr_Michael
December 17th, 1999, 01:34 AM
Better solution: Data Environment -> Visual and easy!

Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece

Joe F. Luster
December 17th, 1999, 08:05 AM
To use a Database object you must first make a reference to DAO. Go to Project, References, Microsoft DAO x.x Object Library. After making this reference, you can then Dim a variable as a database object.

December 17th, 1999, 01:41 PM
Use the following code to set a reference to a database object:

Sub CreateDatabaseX()

Dim wrkDefault As Workspace
Dim dbsNew As DATABASE
Dim prpLoop As Property

' Get default Workspace.
Set wrkDefault = DBEngine.Workspaces(0)

' Make sure there isn't already a file with the name of
' the new database.
If Dir("NewDB.mdb") <> "" Then Kill "NewDB.mdb"

' Create a new encrypted database with the specified
' collating order.
Set dbsNew = wrkDefault.CreateDatabase("NewDB.mdb", _
dbLangGeneral, dbEncrypt)

End Sub

Dr_Michael
December 18th, 1999, 06:29 AM
Finally you have right, but I don't want to use DAO. I thought database object was supported by ADO that I use. I have no experience with DAO...
Thanx man for your help, and all the others of course!

Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece

fgingras
December 19th, 1999, 06:54 PM
If you want to programmatically change the Data Environment database, use something like this:

deObject.YourConnection.Open "PROVIDER=xyz;Data Source=filename.abc"

Francis Gingras