Synopsis: I have a report generated from the report wizard in VB that works, but I only want to load data from the same department as the current user.

Details: The application connects to MySQL using the MySQL Connector/Net. I have a users table in the database, one of the fields is "Dept_ID." The report I currently have works loads data and everything fine, but I only want to load some of the data from the table, specifically where Dept_ID matches the current user's Dept_ID, basically adding the "WHERE" clause to the select statement.

I used the report wizard to generate the report and data table, etc, just followed from step one. I've looked around and have found something about using parameters, but can't seem to figure out how to pass a variable to the parameter, or if that is even the best option. Using the wizard, I don't have any code to show for it and the report works like it should, I just need to figure out how to configure it further.
Any help is appreciated. Thanks.

6 Years
Discussion Span
Last Post by poojavb

Assuming it to be a crystal report.....for paramaters....
u have an option as Parameter Fields in ur Field Explorer WIndow....

Right click on the parameter Field -> New -> a window will be opened -> Enter the parameter name and the type....and nothing.....->Click OK ->A parameter will get created....

In ur Crystal reports menu -> Reports -> Selection Formula -> Record
Expand the Report Fields....

According to ur condition give the parameter to ur dept id....
where ABC is ur table name
DeptID is ur column name
?deptid is ur parameter....

{ABC.DeptID} = {?deptid}

Then run the report for validation by clicking on main report preview tab....
u will get a window asking for deptid...enter the dept id and check....

Hope this is what u need....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.