Link to home
Start Free TrialLog in
Avatar of munzi791
munzi791

asked on

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
Avatar of p_sie
p_sie
Flag of Netherlands image

What you mean by subreport?

Vb datareport has limited options.
Avatar of munzi791
munzi791

ASKER

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
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
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
ASKER CERTIFIED SOLUTION
Avatar of p_sie
p_sie
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
How is the command build up (what is the SQL-string)?
SELECT [RentDates].*, i_Definitions.Property, i_Definitions.Desc
FROM [RendDates] LEFT JOIN i_Definitions ON [RentDates].[Reg] = i_Definitions.Reg;
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  .....
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
Use VB.Net as it is alot easier and includes Crystal reports.
Munzi, I posted in the community support that you answered the question yourself, cause that is not the way to do it!!!

See:
https://www.experts-exchange.com/questions/21215786/Working-Question-answered-by-the-one-that-asked-it.html