Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

With SQL Statemet, How do I create a report 1

Status
Not open for further replies.

np3il

Programmer
Aug 15, 2002
63
US
With SQL Statemet, How do I create a report?

How do I use the data coming from the SQL Command in VB6 to Generate a report of it ???

 
There are several alternatives, depending on your needs and budget, and the complexity of the report.

Printer object from VB will print really easy stuff

MS Datareport tool (Project|Add DataReport) if you like a bit more hard work, but with fair reporting facility

The old version of Crystal reports (it's on your VB installation disks), much better than Datareport

Crystal reports (current version), which you will need to buy. The most sophisticated, but still with a learning curve.


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I am already using MS Date report.

How can I usr the SQL with a run time valie into this report??

Ex.

Using ...

sSelect = "SELECT TICKETS.TICKET_NO, TICKETS.PU_TIME, CUSTOMER.FIRSTNAME, CUSTOMER.LASTNAME, TICKETS.LAST_TICK, TICKETS.PU_EMPL, SERVICES.SERV_ABBR, TICKETS.PU_DATE, TICKETS.STRIP_TAG, TICKETS.AMOUNT, DETAIL.QUANITY, COLORS.COLOR_DESC, COLORS.PATT_DESC "
sFrom = "FROM TICKETS, CUSTOMER, SERVICES, DETAIL, COLORS, TRANDETL "
sWhere = "WHERE TICKETS.CUST_NO = CUSTOMER.CUST_NO AND TICKETS.CUST_NO = CUSTOMER.CUST_NO AND TICKETS.SERV_CODE = SERVICES.SERV_CODE AND TICKETS.SERV_CODE = SERVICES.SERV_CODE AND TICKETS.TICKET_NO = DETAIL.TICKET_NO AND DETAIL.COLOR_NO = COLORS.COLOR_NO AND DETAIL.COLOR_NO = COLORS.COLOR_NO AND DETAIL.TICKET_NO = TRANDETL.TICKET_NO AND TICKETS.TICKET_NO = TRANDETL.TICKET_NO AND DETAIL.TICKET_NO = TRANDETL.TICKET_NO AND (TICKETS.PU_DATE IS NOT NULL)AND (TICKETS.PU_DATE = #" + txtDate.Text + "#) "
sOther = "ORDER BY TICKETS.TICKET_NO, TICKETS.PU_TIME;"

strSQL = sSelect + sFrom + sWhere + sOther
rsRep.Open strSQL

How can I get the data generated here in the report when I performg rptDailySales.Show ????

Thanks B-)
 
Set your datareport recordsource property to the returned recordset.

dr1.RecordSource = rsRep
dr1.Show


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
There is no .. dr1.RecordSource ... Record Source in the DataReport options ...

What am I doing wrong here ???

Thanks B-)
 
Sorry - dr1 is the name of the DataReport. I should have changed it for you:

rptDailySales.Recordsource = rsRep
rptDailySales.Show


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
But stil .... .RecordSource is stil not there ...

What you suggested makes sence, but I can not make it work. There is a DataSource, DataMember but no RecordSource.

What am I doing wrong ???

Thanks B-)
 
My bad! It is Datasource. Sorry I shouldn't try and work from memory at my age!


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I tryed what you suggested and I am getting an error message that says "Compile error: Method or DataMember mot found"

Have I forgotten to set a property??

Is there a process to successfuly complete a report???

Thanks B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top