changing the command text of a command that has been grouped

scarlet13
07-25-2003, 10:20 AM
Hi, I am a newbie to all of this and was wondering if someone could help me with a problem I am having. I am trying to dynamically change the command text for a data environment command that has been grouped. For some reason what I have tried does not work. Here is what I have tried:

I have a data environment with a command called command1 that is grouped. The grouped name is command1_grouped. The grouped command has the following fields: Summary fields has MealName. Detail Fields has MealName and IngrediantName.

I have created a data report that is grouped by the meal name and then lists the ingrediants for that meal. This works fine. However, I would like the user to be able to imput a list of meals and then get a print out. This requires me to build the command text dynamically. But when I try the following I get errors.

DataEnvironment1.Commands("Command1_Grouping").CommandText = (NEW SQL STATEMENT GOES HERE).

DataEnvironment1.Connection1.Execute DataEnvironment1.Commands("Command1_Grouping").CommandText


When I run this I get an error telling me that Command1.IngrediantName cannot be found(this occurs when I try to open the data report). If I ungroup the command and then change the command name back to its original name it works fine, except I can no longer use the group heading in my data report. I.E. DataEnvironment1.Commands("Command1").CommandText = (NEW SQL STATEMENT GOES HERE).

It wont let me use the original command name if it is grouped. In other words if I tried the code above while the command was still grouped I get an invalid procedure or argument error.

As you can probably tell I am at a complete loss here and would really appreciate anyones help

Thanks,
scarlet13

scarlet13
07-25-2003, 12:05 PM
Never mind, I figured out an easier way to do this using paramaters in my SQL statements.

Thanks anyway,
scarlet13

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum