Getting Tabledefs of an ADP

  • Thread starter Thread starter Diana Mueller
  • Start date Start date
D

Diana Mueller

Hello group.

Within my ADP, the CurrentDb function returns null allthough I'm connected
to a SqlServer 2k. How do I get the tabledefs and get/set the connection
string?

Anyone?
 
These concepts are not applicable to an ADP, Diana. CurrentDb and TableDef
are members of the DAO object library, and an ADP does not use DAO. It uses
ADO, and while they do the same jobs (mostly) there is no direct one-to-one
correspondence between DAO objects and ADO objects.

You can obtain the connection string in your ADP from the
CurrentProject.Connection object ...

Public Sub TestSub()
Debug.Print CurrentProject.Connection.ConnectionString
End Sub
 
Brendan Reynolds said:
These concepts are not applicable to an ADP, Diana. CurrentDb and TableDef
are members of the DAO object library, and an ADP does not use DAO. It uses
ADO, and while they do the same jobs (mostly) there is no direct one-to-one
correspondence between DAO objects and ADO objects.

You can obtain the connection string in your ADP from the
CurrentProject.Connection object ...

Public Sub TestSub()
Debug.Print CurrentProject.Connection.ConnectionString
End Sub

I see, thank you!
 
Another thing:

Is it possible to change the ConnectionString at runtime?
If I Try to manipulate CurrentProject.Connection.ConnectionString, I get an
error because the connection is still open.
If i do a CurrentProject.CloseConnection, I get an error just saying that
there was an error while closing the connection without any further
explanation.
What do I have to do to change the ConnectionString property
programatically?
 
There's an example in the NorthwindCS.adp sample app. Look for the procedure
'ChangeDb' in the module 'Startup'
 
There's an example in the NorthwindCS.adp sample app. Look for the
procedure 'ChangeDb' in the module 'Startup'

Wonderful!

I allready ran into the next problem though :(
After changing the connection, the right recordsets (the ones in the
database i just changed to) are displayed, but suddenly my forms become
"read only". I can't edit, delete or add new recordsets.

I checked the properties of the database / tables with the Enterprise
Manager and they are exactly the same as the ones of the original database
/ tables. The databases are even on the same server/instance.

If I change the connection back to the original datasource/initial
catalogue combination the recordsets are editable again.

Any idea, how this might be solved? Thank you so much for your help...
 
Back
Top