-
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.
-
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.
-
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).