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
Printable View
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
Hi,
Please check on Microsoft DAO 3.51 Object Library.
Santulan
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
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
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
Better solution: Data Environment -> Visual and easy!
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
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.
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
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
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