|
-
Jun 19th, 2006, 06:00 AM
#1
Thread Starter
Fanatic Member
generate a report based on SQL statement
Hi
I am using the data report designer.I want that when the user clicks on a command button called "Generate report",to be prompted by an inputbox asking him to enter the CustomerID,if he enters a non null string and press on ok,to generate a report based on the customerID entered by the user.
the syntax of the SQL command:
Select * from Customer where customerID='the value entered in the inputbox'
the report must be generated based on the above SQL statement
how can i do it?
-
Jun 19th, 2006, 06:43 AM
#2
Re: generate a report based on SQL statement
Depending on the db
1) make a query/view that takes parameters
2) write the sql to a string (selection of main fields) then add in the where clause as appropiate.
3) other ways
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 19th, 2006, 07:21 AM
#3
Thread Starter
Fanatic Member
Re: generate a report based on SQL statement
Hi Ecniv
i am using SQL server 2000,my problem is that how can I tell my program that the source of Data is the SQL statement,
thanks
-
Jun 19th, 2006, 07:33 AM
#4
Addicted Member
Re: generate a report based on SQL statement
Hi,
If you make the SQL statement as a stored procedure, set the report recordsource to this and design your report. Then, before you display teh report, filter the contents using the CustomerID. e.g.
if your reportdocument is called RptToView and you Stored Procedure is called f_rptMyBatches, then, the recordselection formula will look like:
RptToView.DataDefinition.RecordSelectionFormula = "{f_rptMyBatches;1.CustomerID} = " & YourCustomerIDHere
where CustomerID is the name of the field.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|