Click to See Complete Forum and Search --> : Data Environment - HELP!
hyme
Aug 1st, 2000, 08:21 AM
Howdy!
Is it possible to create a Data Environment through code and then connect a data report to it? If so, How?
Because,I have a Data environment with a report connected to it.
But, I need to change the SQL statement in the Data environment during run-time! - That is my goal!
Thanx
[Edited by hyme on 08-01-2000 at 09:30 AM]
nexus
Aug 1st, 2000, 08:59 AM
you have a few ways of doing this
1 use stored procedures on the data base and pass them parameters(best option)
2 create a command and pass this a paramater like a stored procedure(but its not compiled on the database so not as quick- second best option)
3 or create a comand and set its comandtext property at run time by creating a sql string ie
strsql = "select * From table"(create sql string)
dataeviroment.comandname.comandtext = strsql
hope this is helpful
*** note might not be the right syntax
hyme
Aug 1st, 2000, 09:05 AM
It's a great help
I can change the Data Environment like this:
DE.Commands("cmFormu").CommandText = "Select * from Client ORDER BY Index"
But, how to you update the text fields on a Data Report
attached to it?
I get the error
"datafield "cmFormu.Client.Index not found"
nexus
Aug 1st, 2000, 09:48 AM
the datafild should update correctly!
so try your query inside the of the command query builder and run it there
if it works there then it will work by setting the comand text property
if it dosnt work check to see if the the query is correct(sounds like it carnt find the index coloum in the data base) and make sure that the text box is bound correctly
(not likly as its throwing an error at the command text you quoted in the cmdtext property!!)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.