473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access 2003 control source use data from external query

7 New Member
I have a complex report in Access 2003. In addition to the query that feeds the report, I have some control sources set to gather data from other queries.

One field uses the following for the control source:

=Format(nz([qryBudgetFilteredByThisFiscalYear12.CNS/Amer12],0),"Currency")
This works fine. However when I change this to:

=Format(nz([qryBudgetFilteredByThisFiscalYear12.CNS/Amer13],0),"Currency")
I get an error saying "Invalid bracketing of name".

The query qryBudgetFilteredByThisFiscalYear12 is a crosstab. One of the column headings is CNS/Amer12 and one is CNS/Amer13.

Any ideas where I should look?
Sep 17 '12 #1
12 2312
twinnyfo
3,653 Recognized Expert Moderator Specialist
Carlos,

The first place I would look is to remove the slash from the query field name. since the slash can also be used for division, it is never wise to include that in a field name. This may be causing your second example above to try to divide two values.

I can't explain why it works for the first one, unles you have a control on the report that has the name "qryBudgetFilteredByThisFiscalYear12.CNS/Amer12".

Just throwing out some ideas and additional DB best practices advice.

let me know if this helps.
Sep 17 '12 #2
CarlosThomas
7 New Member
Thanks for the help. I was looking at the slash thinking it shouldn't be there. Unfortunately, I have so many nested queries that it would take me a couple of hours to remove so I am trying to avoid this.

I did try to create a new blank report with the same record source as the report in question. I then added a text control and used both of the expressions entered in my question and received similar results: the first one work, the second one produced the same error message.
Sep 17 '12 #3
CarlosThomas
7 New Member
This is the SQL from the query I am trying to use as the control source:

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Sum(tblFundBudget.budget) AS SumOfbudget
  2. SELECT tblFundBudget.lineItem
  3. FROM z_fund INNER JOIN ((z_fyFund INNER JOIN this ON z_fyFund.fyID = this.fiscalYear) INNER JOIN tblFundBudget ON z_fyFund.fyfundID = tblFundBudget.fyfundID) ON z_fund.fundID = z_fyFund.fundID
  4. GROUP BY tblFundBudget.lineItem
  5. PIVOT z_fund.fundName In ("CNS/Amer11","CNS/Amer10","CNS/Amer13","AmRec","CDBG","HUD06","DOL 1","DOL10","DOE/YB","REB/YB","OWD","WAL","Unrestricted","CHA","REB","SOM","Hyams","CommCorp","OJJDP","SNAP","HUD02","DYS","CNS/Amer12","PostSec","UW");
I just found out that AmRec doesn't work either.
Sep 17 '12 #4
twinnyfo
3,653 Recognized Expert Moderator Specialist
VERY strange........

However, I can also foresee you creating queries for every Fiscal Year... I also hesitate using Cross Tab queries unless I am absolutely, positively certain that all of the potential fields are guaranteed to be in the results of the cross tab every single time. For example, if there were no values for CNS/Amer13, you would not have that field name available to other objects in your database.

According to theory, if you have data in both columns, both control sources should work on your report.

What are the typical results of your qryBudgetFilteredByThisFiscalYear12 query?
Sep 17 '12 #5
Rabbit
12,516 Recognized Expert Moderator MVP
I'm confused as to why the first one would work. Neither one should work because
[qryBudgetFilteredByThisFiscalYear12.CNS/Amer12]
is wrong as well. It should be
[qryBudgetFilteredByThisFiscalYear12].[CNS/Amer12]
Notice the extra brackets to separate the query alias from the field alias.
Sep 17 '12 #6
CarlosThomas
7 New Member
The query organizes spending by line item and funder. We do create a new query for each fiscal year.

When I run the query there are some columns with no entries. CNS/Amer12 is one of these, so is AmRec. As I mentioned, CNS/Amer12 works fine on the report, but AmRec seems not to. CNS/Amer13 has plenty of entries.
Sep 17 '12 #7
CarlosThomas
7 New Member
@Rabbit - Thanks for your response. I have tried that syntax as well. When I do it that way, I am prompted to enter a value for qryBudgetFilteredByThisFiscalYear12.
Sep 17 '12 #8
Rabbit
12,516 Recognized Expert Moderator MVP
That is most likely because the alias is incorrect. Either because you gave it a different alias, or it's because of a typo, or because the query is not actually in the record source.

If you try to reference a cross tab column for which the data does not exist in the base records, then you will get an error.
Sep 17 '12 #9
CarlosThomas
7 New Member
@Rabbit - The query I am trying to reference is different from the record source of the report. However, this does work as has worked quite well for a number of years. I just don't understand why it's not working for this specific column heading.
Sep 17 '12 #10
Rabbit
12,516 Recognized Expert Moderator MVP
I'm not sure how you're even able to pull the value without a DLookup. If it's not a part of the recordsource, you can't reference a query value in that way. If you try to, you end up getting a #Name? error. So there's something else going on here that we're unaware of.
Sep 17 '12 #11
CarlosThomas
7 New Member
I figured it out with your help. The reference in the control source is to a field name in the query of the record source. The record source query is a union query that pulls CNS/Amer13 from qryBudgetFilteredByThisFiscalYear12 as qryBudgetFilteredByThisFiscalYear12.CNS/Amer13. I saw the name qryBudgetFilteredByThisFiscalYear12 and couldn't figure out why it wouldn't work, since CNS/Amer13 was clearly a field in this query. I finally checked the record source query and saw that CNS/Amer13 was missing while all the other funders were there. I added CNS/Amer13 and it now works!

Thank you both!
Sep 17 '12 #12
Rabbit
12,516 Recognized Expert Moderator MVP
Huzzah! Good luck with the rest of your project!
Sep 17 '12 #13

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

Similar topics

5
3292
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
13
2486
by: MLH | last post by:
I have a form with two controls: !! - combo box !! - text box A button on the form tries to run this SQL when clicked... INSERT INTO BodyMsgsSent (ToWhom, BodyText) SELECT DISTINCTROW !! AS...
7
2150
by: Mike Nygard | last post by:
I'm experiencing extremely slow response times in design mode of my forms since moving to Access 2003. Simply dragging a button to a different position on the form takes 30 seconds or more. The...
17
2058
by: Jana | last post by:
Howdy! I have an Access 2003 SP1 where data tables reside on a server & each workstation runs the front end locally. All 5 users are on the same version of Access. We've been having problems on...
1
2458
by: mdk7 | last post by:
I am very new to developing forms and queries with Access. The task that I am required to complete is as follows: Build a form based user interface that displays various information from the...
3
4324
by: drkknightbatman | last post by:
Hi, I am pretty new to Access 2003 and SQL. I am trying to have a count show up in a query to show specific barcode prefix data between the first and the last day of the previous month. I want to do...
9
4474
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
3
3291
by: shayvillere | last post by:
I'm designing a report and cannot pull data from a query. The control gives me a #Name? error when I do a print preview. I never had this problem with Access 2000. Any ideas?
3
5148
by: HistoricVFP | last post by:
Hello, I’ve been given the task of importing .dbf files from a very old version of Visual FoxPro (version 2.1) into Access (2003). When I import the data straight to Access it errors with: ...
0
7291
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
7357
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
7012
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
7468
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...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4690
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
3180
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...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.