473,473 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CrossTab Query

Hi:

I'm using a "CrossTab" Query to retrieve data. When I get it back, I want
to print the column Headers along the first row of the grid. How to I get
the names of the column Headers? The names of the columns will be dynamic;
i.e., I am listing facilities and getting total transports provided for each
facility. I am returning the Name of the Facility (or it's designator) as
Column headers and want that in the first row...with the totals in the
second row. Is there a way to use visual basic and get the names of the
columns in the Crosstab...and then put each one in a field in the first row?

Your advice would be appreicated.

JP

Apr 15 '06 #1
2 5060

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:SY******************************@comcast.com. ..
Hi:

I'm using a "CrossTab" Query to retrieve data. When I get it back, I want
to print the column Headers along the first row of the grid. How to I get
the names of the column Headers?


Any recordset, regardless of what sort of query you use to get it, will include
a Fields collection.
So something like this will get you the information you need:

Dim oRS As Recordset
Dim oFld As Field

' get data into oRS...

' The number of columns is.oRS.Fields.Count.
Debug.Print "columns needed: " & oRS.Fields.Count

For Each oFld In oRS.Fields
' do something here with each field name
Debug.Print oFld.Name
Next oFld

Now you can play with setting up the grid and labelling the column headers...
Apr 15 '06 #2
Great, Steve... Thanks a million.

JP
"Steve Gerrard" <my********@comcast.net> wrote in message
news:I5********************@comcast.com...

"Joe-Paul" <Ha*********@comcast.net> wrote in message
news:SY******************************@comcast.com. ..
Hi:

I'm using a "CrossTab" Query to retrieve data. When I get it back, I
want
to print the column Headers along the first row of the grid. How to I
get
the names of the column Headers?


Any recordset, regardless of what sort of query you use to get it, will
include a Fields collection.
So something like this will get you the information you need:

Dim oRS As Recordset
Dim oFld As Field

' get data into oRS...

' The number of columns is.oRS.Fields.Count.
Debug.Print "columns needed: " & oRS.Fields.Count

For Each oFld In oRS.Fields
' do something here with each field name
Debug.Print oFld.Name
Next oFld

Now you can play with setting up the grid and labelling the column
headers...

Apr 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
2
by: Sherman H. | last post by:
I have a few questions for crosstab and popup form questions: 1. I created a crosstab as follows: IT Financial Operation John 21 22 ...
4
by: Judy | last post by:
I'm using Access 2003 and was wondering if it is possible to have a paramater selection within a crosstab query so that I wouldn't need to build a new table. I have a select query that I'm using...
7
by: newguy | last post by:
I am trying to get the totals of a table by client by type of income. This query will get what I am looking for with each unique combination as a row: SELECT Sales.Client, BillCode.Type,...
8
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
27
by: Bob | last post by:
running access 2k; mdb w/ linked tables to another mdb (front/back-end); trying to run a query that updates a table FROM information from a crosstab query. I AM NOTT trying to update the...
4
by: m.wanstall | last post by:
I have a crosstab query that compiles data for Months of the year. I have a stacked select query on top of that crosstab query that uses the latest 2 months data and exports it to a fixed length...
4
by: mattlightbourn | last post by:
Hi all, I have a problem which has been driving me nuts. Crosstab queries! I have a database witch a few different tables to do with garment manufacturing. I have a table for a client...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.