473,408 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

source Query works, Chart Doesnt

I have a problem I have never seen before maybe someone can help. I wrote a query and everything was working fine, I then built a chart on it, still so far so good. Management decided they wanted to choose a date range on which to view the data. Next I added a front page form with two combo boxes for date1 and date2, then added a criteria to my query, still everything works (query opens fine and pulls data correctly). This is where the problem started. The chart will no longer open.

Expand|Select|Wrap|Line Numbers
  1. SELECT Format([received date],"mmmmyyyy") AS [date], [tbl-tag_master].Supplier, Sum(1) AS total
  2. FROM [tbl-tag_master]
  3. WHERE ((([tbl-tag_master].[Received Date]) Between [Forms]![Front]![Combo8] And [forms]![front]![combo10]))
  4. GROUP BY Format([received date],"mmmmyyyy"), [tbl-tag_master].Supplier;
  5.  
This is my query the only thing I added was the WHERE statement. The chart now gives the error below, but the query itself still opens fine.

I now get this error "The Microsoft Jet Database engine does not recognize '[forms]![front]![combo8]' as a valid field name or expression."

Any help is greatly appreciated.


Thanks,

Chad
Mar 4 '08 #1
3 1632
Stewart Ross
2,545 Expert Mod 2GB
I have a problem I have never seen before maybe someone can help. I wrote a query and everything was working fine, I then built a chart on it, still so far so good. Management decided they wanted to choose a date range on which to view the data. Next I added a front page form with two combo boxes for date1 and date2, then added a criteria to my query, still everything works (query opens fine and pulls data correctly). This is where the problem started. The chart will no longer open.

Expand|Select|Wrap|Line Numbers
  1. SELECT Format([received date],"mmmmyyyy") AS [date], [tbl-tag_master].Supplier, Sum(1) AS total
  2. FROM [tbl-tag_master]
  3. WHERE ((([tbl-tag_master].[Received Date]) Between [Forms]![Front]![Combo8] And [forms]![front]![combo10]))
  4. GROUP BY Format([received date],"mmmmyyyy"), [tbl-tag_master].Supplier;
  5.  
This is my query the only thing I added was the WHERE statement. The chart now gives the error below, but the query itself still opens fine.

I now get this error "The Microsoft Jet Database engine does not recognize '[forms]![front]![combo8]' as a valid field name or expression."

Any help is greatly appreciated.


Thanks,

Chad
Hi Chad. This is a known issue with the Access Jet database engine. References to controls on a form work fine on a select query but fail in aggregate queries (sometimes) and crosstab queries (always). To overcome this I substitute a function call that returns the control's value instead of by direct reference to the form on which the control is placed. Jet seems to work fine with function calls.

Place the following function definition code in a public code module of your database (under Modules in the database window). If you don't have any modules defined so far create a new one and save it under any suitable name.

Expand|Select|Wrap|Line Numbers
  1. Public Function FormFieldValue(FormName As String, FieldName As String)
  2.     FormFieldValue = Forms(FormName).Controls(FieldName)
  3. End Function
Then replace the references to the form fields in your query criteria cells with calls to the function above, like this:

Expand|Select|Wrap|Line Numbers
  1. Between FormFieldValue("Front", "combo8") And FormFieldValue("front", "combo10")
-Stewart
Mar 4 '08 #2
Thanks a million, worked perfect!
Mar 6 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
Thanks a million, worked perfect!
Glad to have been able to help, Chad! -S
Mar 6 '08 #4

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

Similar topics

5
by: TC | last post by:
Hello, I am familiar with obtaining source file reference material from the system clipboard using the old Win32 API. For example, copy an Excel chart onto the clipboard and goto Word. Under,...
0
by: TC | last post by:
Hello, Here is what I'm trying to do: -- Make sure both MS Excel and MS Word are running -- Create an Excel chart -- Save the Excel file -- Copy the Excel chart onto the clipboard using Ctrl...
1
by: Michael DeLawter | last post by:
Using Access 2002. I have a chart in a report that is currently based on a query in which the user enters the start and end date for the chart to display. Both the start and end dates have been...
4
by: Andy Davis | last post by:
I have developed a number of reports that are based on parameter queries where the user enters criteria such as a date range and a sales rep say. I want to be able to show a graphical picture in...
2
by: Claus Haslauer | last post by:
Hi, I want to create a crosstab query that looks like this Date | Elevation 1 | Elevation 2 | ... ______________________________________________________________________ Date 1 | xx.y | xx.y...
8
by: dkelly | last post by:
I wish to create a report with a chart, but I want to use a SQL statement as the source of the data, using VBA code in the reports load event I found the following snippet Dim objGraph As...
3
by: devagupt | last post by:
I have another question in queries and charts. I ran a query to count the number of records present in a field and sorted it in ascending order. WHen i make the chart , it doesnt display it in...
3
by: Widge | last post by:
Hi, I've made a piece of VBA that uses a combination of combolists and listboxes to run a query. I just can't think of a way to make this query generate a chart based on its results. Here is my...
2
by: jhaxo | last post by:
How can I implement a cross browser javascript strip chart that does not leak memory. I have treid several off the shelf and home made charts. the basic test is to leave them running, redrawing the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
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...

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.