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

Home Posts Topics Members FAQ

Invalid field or expression problem

8 New Member
I'm having issues with Access. I've not used it much before now so don't really know much about it, but i have used SQL and VB before.

I have a union query (which ill call qryA) that references a combo box on a form in one of the where clauses. It also references another query (which i'll call qryB) that also references the same combo box. These both work fine.

However my problem is that I have a third crosstab query (which i'll call qryC) that references the first query (qryA) as it's "table". However when i run this query i get an error saying that my reference to the combobox ([forms]![formname]![comboboxname]) is an invalid field or expression.

If this is confusing i'll try including a diagram type thing:

qryC (transform...select...from qryA...)

qryA
(select...from...where [forms]![formname]![comboboxname]...
union
select...from qryB...)
Sep 1 '06 #1
6 1975
PEB
1,418 Recognized Expert Top Contributor
Is your query A is good And function normally?
Sep 1 '06 #2
Shifter
8 New Member
Yes query A, when run by itself, runs perfectly. As does query B. query C (the cross tab query) works perfectly when it references a table that has the same stuff as queryA.

query A was originally used to make the table the query C originally referred to, but i wanted to turn it into a query, instead of a table that constantly needed updating.

Thanks for the quick response by the way :)
Sep 1 '06 #3
PEB
1,418 Recognized Expert Top Contributor
Why do not try instaed the paramater value YOU use in query A use the choice done in the combobox?

To do this you have to write an after update statement that deletes the Query A
And creates it using the value of the combo box!

So instaed to have [forms]![formname]![comboboxname]. you'll have "my result"

And when your form isn't open the crosstab can be opened!


And you don't need a separeate table!
Sep 1 '06 #4
Shifter
8 New Member
Oh wait! i forgot to mention that queryB also references the combo box. In fact queryB IS the first half of queryA (as in, if you remove the union and the bit after that in queryA, that's queryB).

And i personally don't think that regenerating the query every time the combobox value is changed to hard code the value of the combo box into it is very good. Firstly that defeats the purpose of that part of the query being a dynamic parameter. It also means that whatever parameter is chosen last will carry over still hard-coded into the query for next time the form is open and if the user doesn't change the value in the combo from it's default (which may NOT be the value currently in the query) then the query will still run the values for last time. Of course you could re-write the query when the form is opened up so that the query will go back to the default value, however it doesn't seem like a very good practise to me.

Is there another way to get around this problem still using a dynamic parameter? Maybe if i changed the parameter to being a normal dynamic parameter (as opposed to its current combo-box reference), is there a way to parse parameters through when a query is run, like with a stored procedure?
e.g. queryA (parameter1, parameter2,...)
Sep 4 '06 #5
Shifter
8 New Member
I seem to have solved this problem by creating a public function in a module that simply returns the value of the combobox, and using this function in the query instead of directly referencing the combo box itself. Thanks for your help PEB.
Sep 4 '06 #6
PEB
1,418 Recognized Expert Top Contributor
Hi,
I'm very happy that your problem is resolved!
About using static expressions in queries... 2004 I used only the dynamic parameters from Forms and this was till my database was small - till 100 000 records!

When my database became bigger My queries runned very slowly! One day I've done a test! I've tried to chaange the dynamic parameter with static expression and the query ran 10 times faster!

Now reelly I don't use paramaters in my queries :)

Have a nice day!
Sep 4 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
When I execute the following (with an OleDBDataAdapter), wanting to add a row to a visual foxpro table: myrow= datasetTarget.Tables(0).NewRow 'fill all columns here like.. row(i)= myvalue '...
3
by: Joe | last post by:
Back in March I submitted a patch for cgi.py to sourceforge to fix a problem with the handling of an invalid REQUEST_METHOD. I thought I followed all the steps to properly submit the bug and...
1
by: Steve | last post by:
Hello, I get an error in my xslt document using vs.net 2005 and Xml Spy. Any help is greatly appreciated! ================ Error: ================ {"'$Field/name()' is an invalid XPath...
3
by: Earthling | last post by:
Any help would be appreciated to solve the following simple problem that I will describe. *** There is a form called "red chocolate form". The form has a particular subform field that has a...
1
by: Andre | last post by:
I am needing to Parse some text fields, where a 3rd party application i use stores data from a user created expression. the user creates and expression such as this: ActualSizeYN =Y?...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
15
by: David | last post by:
Hi, I have built a web application that will be a very high profile application. We had tested it, demonstrated it and shown that it all works. On a dress rehearsal run through, it failed...
0
by: dba123 | last post by:
THERE HAS TO BE A SOLUTION FOR THIS!!!! How can I get around the limitation in SSRS 2005 of being able to SUM a Group referenced field in my FOOTER!!! It's driving me nuts My footer field's...
8
by: glitke | last post by:
I need the quantity entered in a field to be <= a certain quantity. I've opened the field properties and entered the following under the "Validation Rule". <= ( sum ( ( ! ) Where ( ( ! = ) AND (...
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
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...
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: 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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
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.