472,784 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

Access 2003: crosstab query won't use reference to form

DFS
I've been working around this for years (I believe), so I figured someone
here might know:

Why won't a crosstab query accept a value from a form reference?

TRANSFORM Format(First(QtrAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm.Subform.Form.PropertyCode
GROUP BY PropertyCode, Survey, Question
PIVOT [Month] & '-' & [Year];
This crosstab query won't run at all. The error is "Jet db engine doesn't
recognize 'form reference' as a valid field name or expression.

Thanks

Nov 13 '05 #1
3 6109
I'm not seeing that problem in A2003.

Double-check that the names are correct, by pressing Ctrl+G to open the
immediate window, and entering:
? Forms.MainForm.Subform.Form.PropertyCode
You may find that the Name of your subform control is not the same as the
name of the form that it loads (its SourceObject).

If that checks out, try declaring the parameter in the query.
In query design view, choose Parameters from the Query menu.
In the dialog, enter:
Forms.MainForm.Subform.Form.PropertyCode Long Integer
or whatever type is appropriate.

If you are still stuck, make sure that the Name AutoCorrect boxes are
unchecked under:
Tools | Options | General
and then compact the database.

--
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.

"DFS" <no****@nospam.com> wrote in message
news:10*************@corp.supernews.com...
I've been working around this for years (I believe), so I figured someone
here might know:

Why won't a crosstab query accept a value from a form reference?

TRANSFORM Format(First(QtrAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm.Subform.Form.PropertyCode
GROUP BY PropertyCode, Survey, Question
PIVOT [Month] & '-' & [Year];
This crosstab query won't run at all. The error is "Jet db engine doesn't
recognize 'form reference' as a valid field name or expression.

Nov 13 '05 #2
DFS
Allen Browne wrote:
I'm not seeing that problem in A2003.

Double-check that the names are correct, by pressing Ctrl+G to open
the immediate window, and entering:
? Forms.MainForm.Subform.Form.PropertyCode
You may find that the Name of your subform control is not the same as
the name of the form that it loads (its SourceObject).
Names are fine. Still won't work.

If that checks out, try declaring the parameter in the query.
In query design view, choose Parameters from the Query menu.
In the dialog, enter:
Forms.MainForm.Subform.Form.PropertyCode Long Integer
or whatever type is appropriate.
Parameters is grayed out in the Query menu, but I added the PARAMETERS line
to the beginning of the SQL statement and it worked.

My usual workaround is a function in the where clause, such as WHERE
PropertyCode = getPropertyCode()

which worked fine with no PARAMETERS statement.

But I was wondering (and still do actually) why the form reference in the
WHERE clause won't work (without a PARAMETER statement, which standard
SELECTs don't require). Guess it's just an Access foible.

Thanks Allen


If you are still stuck, make sure that the Name AutoCorrect boxes are
unchecked under:
Tools | Options | General
and then compact the database.
"DFS" <no****@nospam.com> wrote in message
news:10*************@corp.supernews.com...
I've been working around this for years (I believe), so I figured
someone here might know:

Why won't a crosstab query accept a value from a form reference?

TRANSFORM Format(First(QtrAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm.Subform.Form.PropertyCode
GROUP BY PropertyCode, Survey, Question
PIVOT [Month] & '-' & [Year];
This crosstab query won't run at all. The error is "Jet db engine
doesn't recognize 'form reference' as a valid field name or
expression.

Nov 13 '05 #3

"DFS" <no****@nospam.com> wrote in message
news:10*************@corp.supernews.com...
But I was wondering (and still do actually) why the form reference in the
WHERE clause won't work (without a PARAMETER statement, which standard
SELECTs don't require). Guess it's just an Access foible.


This has been so since at least Access 97. It is well documented. See for
example KB articles 209778 and 91710.
Nov 13 '05 #4

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

Similar topics

4
by: Michael John | last post by:
Dear Oracle Developers, my task is to make up a Oracle View from a Pivot table in MS Access. Given are two tables to join: T_FIRM: FIRM_ABBR VARCHAR2(3 BYTE), FIRM_LONG ...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
1
by: libbythomas | last post by:
I created an Access 2000 form from a query. But I cannot edit it. I can flip through the records. If I create a table from the query (maketable) and then create the form from the table, it is...
2
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
1
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own...
1
by: bobykim | last post by:
Hi All, I'm using MS Access 2003 in a Windows XP environment. I've created an aging report for my department that is based on what I call the "Main query" with an IIf statement that allows the...
4
by: rdsandy | last post by:
Hi, I have some code below in VBA for Access 2003 which is on a button called "RentalCrosstabPercTtlQtyMonthLoc_Click". This is a crosstab query which brings up rental items down the side, who...
23
by: helm | last post by:
Folks, could anyone advise ... Is there a significant difference in crosstab capabilities in Access and Excel? Using Office XP 2002 ... to produce a crosstab report I developed it in Excel from...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.