Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 770
  • Last Modified:

Sub Reports in a Data report in VB6 - URGENT

Hi All,

I am in the middle of converting my system from Access2000 to VB and SQL.  One of my access reports has a sub report how do i do a subreport in a VB data report.

Kind regards,

Munzi
0
munzi791
Asked:
munzi791
  • 6
  • 5
1 Solution
 
p_sieCommented:
What you mean by subreport?

Vb datareport has limited options.
0
 
munzi791Author Commented:
ummm for example i have a table showing all the vehicle details, ie reg, color, model ect and i have another table showing when the car was in use ie 12/11/04, 13/11/04 and the table are linked by the reg number.

So i need a report in a format similar to this

Vehicle details Reg:
  Color : Red
  Type : Saloon
  x: x
  y: y
  more : depending on table

    Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
Next Vehicle ans so on

I hope you can understand this
0
 
p_sieCommented:
That is possible

Right click in the datareport and click on insert group header/footer
Then put the items you want in the 'header' in the header band and the sub-items (the dates in your case) in the detail-band.

Also check : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconUsingMicrosoftDataReportDesigner.asp 
for more info on the datareports
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
munzi791Author Commented:
I have already tried this but this gives me the information in the following format

Vehicle details Reg:
  Color : Red
          Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
  Type : Saloon
          Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
  x: x
          Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
  y: y
         Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
  more : depending on table
    Dates in use
      Date: 12/11/04   Reason: Rent
      Date: 11/11/04   Reason : Skip
      more: depending on table info
Next Vehicle ans so on

So as you can see it is repeating the dates for each vehicle property.

Rgds
0
 
p_sieCommented:
You have to put all the vehicles properties in ONE header band!

How is the data provided to the datareport i.e. what's the structure?
0
 
munzi791Author Commented:
I am using the following properties;

DataSource = DataEnvironment1
Datamember = Command1

If i do what you have suggested i get an error message 'Report sections do not matchdata cource'

Rgds
0
 
p_sieCommented:
How is the command build up (what is the SQL-string)?
0
 
munzi791Author Commented:
SELECT [RentDates].*, i_Definitions.Property, i_Definitions.Desc
FROM [RendDates] LEFT JOIN i_Definitions ON [RentDates].[Reg] = i_Definitions.Reg;
0
 
p_sieCommented:
Add a 'Group By' clause with the items you want in the header-band!

SELECT [RentDates].*, i_Definitions.Property, i_Definitions.Desc
FROM [RendDates] LEFT JOIN i_Definitions ON [RentDates].[Reg] = i_Definitions.Reg
GROUP BY  .....
0
 
munzi791Author Commented:
i have already tried this but this does not work for the following reason,

I need 2 details section as the properties comes from one table and the dates from another table, the prperties are unique to each vehile ie vehicle 1 can have colour, type, model and vehicle 2 can have type, sige, weight, door etc after this we need to add the dates when the vehicle was in use.  If i group them the way you have suggested i will get these results;

Vehicle 1
 property 1
   dates
   dates
   dates
property 2
   dates ' repeated again
   dates ' repeated again
   dates ' repeated again
property 3
   dates ' repeated again
   dates ' repeated again
   dates ' repeated again
0
 
munzi79Commented:
Use VB.Net as it is alot easier and includes Crystal reports.
0
 
p_sieCommented:
Munzi, I posted in the community support that you answered the question yourself, cause that is not the way to do it!!!

See:
http://www.experts-exchange.com/Community_Support/Q_21215786.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now