Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 15th, 2008, 11:51 AM
Authorized User
 
Join Date: Oct 2007
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to debbiecoates
Default filling a datagrid with a crosstab?

I am a little confussed as how to do this, was wondering if anyone could help.

I have a 1:M table project to project period (ie, each project can define x amount of periods) for example

Projectid ProjectName
10000 projectOne
10001 ProjectTwo


projectPeriodID Projectid Period From To
1 10000 1 01/01/2007 31/01/2007
2 10000 2 01/02/2007 28/01/2007
3 10000 3 01/03/2007 31/03/2008
4 10001 1 01/01/2007 30/06/2007
5 10001 2 01/07/2007 31/12/2008


each project also has x amount of cost types

CostTypeID CostType
1 Building
2 Furniture
3 Phone


Each project makes a payment to each costtype in each period, which I want to display in a datagrid in vb from a recordset

I think I need a table linking the project periods to the cost types

ProjectCostID ProjectPeriodID CostTypeID Amount
1 (auto number) 1 (fk) 1(fk) 1200
2 1 2 300
3 1 3 600
4 2 1 1200
5 2 2 300
6 2 3 600
7 3 1 1200
8 3` 2 100
9 3 3 600

Now what I want to do is pick up a recordset to fill in my datagrid, so that it looks like this (below) and so that I can click in a cell in the datagrid and edit it if required. Can anyone tell me how to pick this recordset up; I am not sure of the joins and stuff that I would need? Or if in fact my tables are correct, I would appreciate any feedback

          1 2 3 Total
Buildings 1200 12000 12000 36000
Furniture 300 300 100 700
Salary 600 600 600 18000








Similar Threads
Thread Thread Starter Forum Replies Last Post
CROSSTAB Stella Evangelin Crystal Reports 1 September 8th, 2006 10:24 AM
crosstab yula Crystal Reports 1 August 31st, 2006 11:27 AM
Filling out DataSet from Datagrid MAKO C# 2 May 13th, 2006 08:15 AM
filling of datagrid rahulyadav23 .NET Framework 2.0 2 June 29th, 2005 06:24 AM
filling Dataset with datagrid variables frankv25 ASP.NET 1.0 and 1.1 Professional 1 August 30th, 2004 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.