I am doing a report which shows rows from a table 'tblAccounts'. The
tblAccounts table is related to the tblUsers table by the userid. The
2 datasets I built are dsAccounts and dsUsers
The commandtext for dsUsers is
select 0 as userid, '(All)' as username from tblemployeeprofile UNION
select userid, username from tblemployeeprofile
I wanted to have a parameter for the user on the report, so when the
user is selected (the userid is the value, the username is the label)
the rows of all that selected user in the tblAccounts are shown in the
report. Also there is the '(All)' item (which has a value 0) in the
users dataset which will shows the rows of all the users.
Typically I would do a query for the dataset for tblAccounts as
follows
="select * from tblaccounts " & IIf("Parameters!userid.Value=0","","
where userid = Parameters!userid.Value")
But this gives me an error message.
"An error occured during report processing. Cannot set the commandtext
for dataset dsAccounts. Error during processing of the commandtext
expression of the dataset 'dsAccounts'"
I tried simplifying the commandtext by bringing down the commandtext
of dsAccounts
="select * from tblaccounts " & IIf("1=2",""," where userid = 72")
But the error message still says
But this gives me an error message.
"An error occured during report processing. Cannot set the commandtext
for dataset dsAccounts. Error during processing of the commandtext
expression of the dataset 'dsAccounts'"
Helppp!
Anand Sagar