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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEM INSERTING FIELDS TO DATAREPORT FROM DATAENVIROMENT

Status
Not open for further replies.

aggeliki23

Programmer
Feb 12, 2007
38
GR
hello everybody!
I have created a sql query in visualdata manager of vb6
"SELECT sum(OrderDetails.ProdSumPrice) as totalSum from orderDetails group by orderID;" saved as sumPriceQry.
It calculates the sum price of all products a customer has ordered. I am trying to create an invoice report with data report. I used DataEnviroment, i added a command button and in the property window of it, in general tab, i set the connection onto connection1 (mydb), in dataObject i selected view and in object name the name of the query sumPriceQry. My problem is that i can not drag and drop totalSum into any section of my data report.
I tried design a RptTextBox but in properties window, in the DataMember there isn't the command1 to select it, to made this to representate the sumPriceQuery. Any ideas please?

Thank you
very much
Aggeliki
 
Generally the DataReport object would use the query which pulls all the products from that customer. In the body section of the DataReport add text boxes for each required field. The datareport when viewed will show one row for each row returned from the query. Your total is done by right-clicking in the footer section of the report, and adding a Sum function. You don't need a seperate query for the total, the report has that functionality

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thank you very much, i did this but i am getting a bug says "report width is larger than the paper width" So i can see nothing in data report in execution phase.
Can anyone tell me the right width and height of a data report please?
 
If your report is wider than will print onto the default settings of your default printer you either need to make the report narrower (smaller textboxes, smaller fonts etc) or set the orientation to landscape
Code:
DataReport1.Orientation = rptOrientLandscape

I seem to recall your VB6 needs to have at least SP5 for this to work

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thank you, i tried this code but as you told before too, i must have at least sp5 for this to work and i haven't.
So i tried this:
invoiceRep.LeftMargin = 0
invoiceRep.RightMargin = 0
and it works.
But unfortunately i have another error says
"Report Sections do not match datasource.
I right click to my datareport design and i checked retrieve structure, then i clicked yes to the messagebox appeared, but in my datareport design i have no group header section, so insert 2 group headers sections, one before details and one after. I realized than the retrieve structure is not checked after this if i right click in my data report. So, what i can I do having group headers in my report and have the retrieved structure checked just not to have this error message?
 
First you should get the latest SP (SP6) and install it. It's a free download from MS:

If your data is not from a GROUPED query then group headers don't work as there are no groups! If you have a GROUPED query then the Group header and footer sections should just appear when you retrieve the new data structure

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thank you very much for your help, i understand what's going on with group headers. Just a question, my operating system is Windows XP SP2. I saw in your link the system requirements. Will I have problem if i install it because of Windows XP SP2?
 
I don't know of any problems - I have XP SP2 and VB6 with SP6 with no problems

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
hi
I want use date (today) on header report of datareport in vb6
but i cant.
please help me for my problem
 
Hi and welcome to Tek-Tips. Read faq222-2244 to see how to get the best from these forums.

For this question just add a RptLabel control to your header section the set its value to Date() in the DataReport_Initialize() event

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
for report too wide ..

I have found that when editing a report .... particularly when PASTE

the report is often widened because the position of the field being pasted

when field is *dragged* back into correct position then
Report remains at the Extra Width

Clock on Right Hand of report and Narrow it back to desired size

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top