You have to first Close the rs.Command Object, then set the Command Text of the command object to teh new SQL, then reexecute the
command object which recreates the recordset. THen it would not hurt to rebind the list..
If DE.rsCommand.state=1 then de.rscommand.close
Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Want to know more? Check out the MSDN at msdn.microsoft.com or the Microsoft Knowledge Base at support.microsoft.com
This posting is provided AS IS, with no warranties, and confers no rights.
>Subject: DataEnvironment SQL change at run time
>Date: Thu, 22 Aug 2002 22:21:30 +1000
>X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
>Xref: cpmsftngxa10 microsoft.public.vb.database:85387
>I am fairly new to VB and a real greenhorn on DataEnvironmet, but I am
>I am programmatically changing the CommandText property to a different SQL
>query but it does not reflect on the connected DataList control at run time.
>It just stays with the data from the initial CommandText as it shows in the
>properties at design time. I have tried things like:
>but nothing seems to work.
>Maybe I am trying a completely wrong approach here.