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

Home Posts Topics Members FAQ

Constant Crosstab Headings & functions to create queries

Any Google search will show that somewhere out there is a kind spirited
Michel Walsh has been most generous in his time over the years in giving,
in reply to several postings on the matter, a Function as a solution to
holding column headings constant, so that a cross tab query (the fields of
which would otherwise change depending on the input data) can be reliably
used as the basis of another Query, Report or Form. What, unfortunately, he
seems with similar consistency to avoid is telling us all how to actually
use that Function! Anyone got any ideas. Basically, it returns a string
starting "SELECT .....". How can I use a function generating a SQL
statement to actually create a useable Query?
Nov 12 '05 #1
4 1668
You can create a QueryDef object, and set its SQL property to the SQL
statement generated by the function. As well, you can set the RecordSource
for a report equal to the SQL statement itself.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"ITMA" <mi*****************@net.net> wrote in message
news:3f**********@mk-nntp-1.news.uk.worldonline.com...
Any Google search will show that somewhere out there is a kind spirited
Michel Walsh has been most generous in his time over the years in giving,
in reply to several postings on the matter, a Function as a solution to
holding column headings constant, so that a cross tab query (the fields of
which would otherwise change depending on the input data) can be reliably
used as the basis of another Query, Report or Form. What, unfortunately, he seems with similar consistency to avoid is telling us all how to actually
use that Function! Anyone got any ideas. Basically, it returns a string
starting "SELECT .....". How can I use a function generating a SQL
statement to actually create a useable Query?

Nov 12 '05 #2
I'm still learning the basics of VBA but it sounds to me like a
function-created-query can only be accessed within yet more VBA code ...?
Am I right in thinking I cannot use a VBA function to create a 'real' Query
as a layman would know it in the database window's list of queries?
You can create a QueryDef object, and set its SQL property to the SQL
statement generated by the function. As well, you can set the RecordSource
for a report equal to the SQL statement itself.

Nov 12 '05 #3
"ITMA" <mi*****************@net.net> wrote in
news:3f**********@mk-nntp-1.news.uk.worldonline.com:
Any Google search will show that somewhere out there is a kind spirited
Michel Walsh has been most generous in his time over the years in
giving, in reply to several postings on the matter, a Function as a
solution to holding column headings constant, so that a cross tab query
(the fields of which would otherwise change depending on the input data)
can be reliably used as the basis of another Query, Report or Form.
What, unfortunately, he seems with similar consistency to avoid is
telling us all how to actually use that Function! Anyone got any ideas.
Basically, it returns a string starting "SELECT .....". How can I use
a function generating a SQL statement to actually create a useable
Query?


CurrentProject.Connection.Execute _
"CREATE PROCEDURE qryBlah (parBlah Integer) AS DELETE * FROM tblBlah WHERE
fldTransactionID = parBlah"

ACXP

gives ... for qryBlah

PARAMETERS parBlah Long;
DELETE tblBlah.fldTransactionID, *
FROM tblBlah
WHERE (((tblBlah.fldTransactionID)=[parBlah]));

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4
No that's not correct.
Sub CreateQueryDAO()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb()
Set qdf = db.CreateQueryDef("MyQuery")
qdf.SQL = "TRANSFORM ...

Set qdf = Nothing
Set db = Nothing
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ITMA" <mi*****************@net.net> wrote in message
news:3f**********@mk-nntp-1.news.uk.worldonline.com...
I'm still learning the basics of VBA but it sounds to me like a
function-created-query can only be accessed within yet more VBA code ...?
Am I right in thinking I cannot use a VBA function to create a 'real' Query as a layman would know it in the database window's list of queries?
You can create a QueryDef object, and set its SQL property to the SQL
statement generated by the function. As well, you can set the RecordSource for a report equal to the SQL statement itself.

Nov 12 '05 #5

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...
3
by: Darleen | last post by:
I am seeking conceptual here on how to get started with a "3D Matrix" in Access. We run a training center which holds multiple classes in multiple cities at multiple times. So I need to create a...
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...
3
by: Paula | last post by:
I need to do a summary using a crosstab query. The data has a Date field (Not named "Date"). I can do the Row Heading and Value but am having trouble with the Column Heading. The summary Columns...
1
by: greg | last post by:
I have a table that I want to left join with crosstab query and I want to be able to edit data in the table (only). However, once I perform the join, the entire query result cannot be edited. Is...
4
by: rinmanb70 | last post by:
I need help writing a crosstab query. I would like the column headings to be the last 6 months, the row headings to be billers, and the data in the middle to be both the date that a payment was...
4
by: ringer | last post by:
I need help with a crosstab query. I would like the column headings to be the last 6 months, the row headings to be billers, and the data in the middle to be both the date that a payment was made...
8
by: Paul H | last post by:
I want to base a form on a crosstab query. The query shows statistics for a user defined period. The column headings will look something like this: ClientID Month01 Month02 Month03 etc.. ...
13
beacon
by: beacon | last post by:
I'm working on creating a dynamic report that is based on a crosstab query. It's similar to the method described at the following link: http://support.microsoft.com/kb/328320 I've tweaked the...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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.