PDA

Click to See Complete Forum and Search --> : Command text on Data Enviroment Command


davey_turn
Nov 6th, 2000, 04:25 PM
Here's a little problem that is really bugging me, I hope someone has had it before.
I'm using a data enviroment with one or more commands as the source for data reports, it all works fine until I try to set the connection string of the DEconnection and the command text of the DEcommand programatically. This generates an error "method 'item' of object 'commands' failed". If I use the on error resume next and repeat the command text it works ok - but it's not very elegant. Hope one of you gurus out there can help.

RIVES
Nov 7th, 2000, 08:14 AM
Make sure that the fields in your dataenvironment command are the same as the new sql string you are placing.


also, after you have set the new datasource name, try

dim strnewcon as string

deconnection.properties("Data Source").value equals (my equal sign does not work) "C:\database\data.mdb"
strnewcon equals deconnection.connectionstring
deconnection.connectionstring equals strnewcon

looks weird but at times it solves problems.

davey_turn
Nov 7th, 2000, 10:28 AM
Thanks for the help, it didn't work but it put me in the right direction. The problem turned out to be the DEconnection.ConnectionString. The ConnectionString property can only be set at run time, while the ConnectionSource property can only be set at design time. The Conection String is made up of 2 parts (the connection string first then the connection source appended).