473,767 Members | 2,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Qt rAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm. Subform.Form.Pr opertyCode
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 6173
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.Pr opertyCode
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.Pr opertyCode 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.supe rnews.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(Qt rAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm. Subform.Form.Pr opertyCode
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.Pr opertyCode
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.Pr opertyCode 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.supe rnews.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(Qt rAvg),'Fixed') AS FirstQtrAvg
SELECT PropertyCode, Survey, Question
FROM SurveyData
WHERE PropertyCode = Forms.MainForm. Subform.Form.Pr opertyCode
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.supe rnews.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
2896
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 VARCHAR2(70 BYTE), CONSTRAINT PK_FIRM PRIMARY KEY (FIRM_ABBR)
15
4403
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 of students and columns of activities and the data are the students' scores in each activity. No problem, almost. The problem is that there are five classes at the moment and will be more classes (or courses) in future semesters. I don't want...
1
10087
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 editable. But that is not the way I want it. Any suggestions?
2
2942
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 sub-report will capture what grades the student has achieved in a list of different subjects and the reason I need it to be dynamic is that students take different subjects. Basically I've been trying to doctor the KB article on dynamic
52
9981
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 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
1
5164
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 column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
1
4110
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 user to define the dates into 30 day aging segments. Then I've created a crosstab query which counts the results. How I'd like the report to appear is like this: Entity_Type | 1 to 30 days | 31 to 60 days | Over 60 days OPFACT ...
4
2490
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 rents along the top, the rental month and total number of each item on that month as rows next to the item, something like this: Item TotalQty Month Renter1 Renter2 .... PC 234 Aug-2007 2.33 4.55 ...
23
2562
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 a query datasource in Access. One good thing about this was the ability to select both a date header and then a specific time header for the crosstab value. Try as I might, I cannot see a way to replicate this in Access either directly using a...
0
9571
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.