473,623 Members | 3,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use queries in reports

beacon
579 Contributor
Can you use queries in reports? I'm trying to enter a SQL statement in a text box on a report, but if I do it with an equal sign I get a syntax error. If I do it without an equal sign I get an invalid control source.

If this is possible, where am I going wrong?

Here's my SQL statement:
Expand|Select|Wrap|Line Numbers
  1. SELECT CountOfSkillLevel FROM qrySkillsWF WHERE SkillLevelID = 1
Thanks for the help
Oct 26 '07 #1
37 1710
nico5038
3,080 Recognized Expert Specialist
Can you use queries in reports? I'm trying to enter a SQL statement in a text box on a report, but if I do it with an equal sign I get a syntax error. If I do it without an equal sign I get an invalid control source.

If this is possible, where am I going wrong?

Here's my SQL statement:
Expand|Select|Wrap|Line Numbers
  1. SELECT CountOfSkillLevel FROM qrySkillsWF WHERE SkillLevelID = 1
Thanks for the help
To get the data out of a table you'll need the DLookup() function like:
Expand|Select|Wrap|Line Numbers
  1. =DLookup("CountOfSkillLevel","qrySkillsWF","SkillLevelID = 1")
Nic;o)
Oct 27 '07 #2
NeoPa
32,566 Recognized Expert Moderator MVP
You won't need the query though. You can also use DCount() on the underlying table for similar results (assuming of course that the counting is as simple as it would appear).
Oct 27 '07 #3
beacon
579 Contributor
I tried the DLookup in the report, but it's not returning a value. It's not even returning an error. I typed it in exactly as shown, checked the names of the tables and columns, and it is coming back blank.

Any ideas what I'm doing wrong? Does it make a difference that it's on a report?
Oct 29 '07 #4
beacon
579 Contributor
Nevermind...I got it to work. Thanks for the help you guys.
Oct 29 '07 #5
NeoPa
32,566 Recognized Expert Moderator MVP
I'm not clear exactly what you've tried.
How about you post the current SQL of the query the report is built upon, and any relevant controls in the report that are not working as expected.
Oct 29 '07 #6
NeoPa
32,566 Recognized Expert Moderator MVP
Nevermind...I got it to work. Thanks for the help you guys.
Oh, no worries then ;)
I sometimes have to leave a page idle for (quite) a while before I get around to posting a response.

Do you want to let us know what your solution was. In case anyone finds this thread at a later date and wonders how they should duplicate your success.
Oct 29 '07 #7
beacon
579 Contributor
Ok...I lied. It partially worked, but I know it's probably because of how I have my report setup.

Let me lay it out from the beginning and see if anyone can't figure out where I'm going wrong.

I have a report that is setup like this:
Expand|Select|Wrap|Line Numbers
  1. (Program Header)
  2. Program
  3.     (SkillLevelID Header)
  4.      SkillLevel     SkillLevelID(not visible)
  5.            (Details)
  6.             LName   FName   JobTitle   Email   PhoneExt
  7. (Program Footer)
  8.                                     Total Beginner Employees                TextBox
  9.                                     Total Intermediate Employees           TextBox
  10.                                     Total Advanced Employees               TextBox
  11.                                     Total Program Employees                 TextBox
  12.  
I'm trying to get the total individual skill level for each individual program and have it summarized in the program footer. Then at the end of the report I wanted to put a comprehensive summary.

I created a query to count the data because I couldn't use a count in the program footer to summarize the data in different sections.

When I setup my query I put CountOfSkillLev el and SkillLevel, but that just did totals for the skill level. Then I added program, but my DLookup didn't have anything in it to determine that program was necessary for the lookup.

Here's the SQL for my query:
Expand|Select|Wrap|Line Numbers
  1. SELECT qryWFSummary.Program, Count(qryWFSummary.SkillLevel) AS CountOfSkillLevel, tblSkillLevel.SkillLevel
  2. FROM qryWFSummary INNER JOIN tblSkillLevel ON qryWFSummary.SkillLevelID=tblSkillLevel.SkillLevelID
  3. GROUP BY qryWFSummary.Program, tblSkillLevel.SkillLevel;
  4.  
Right now my DLookup looks like this:
Expand|Select|Wrap|Line Numbers
  1. =DLookUp("CountOfSkillLevel","qrySkillsWF","SkillLevel = 'Beginner'")
  2.  
Thanks for the help and sorry for thinking I had it figured out.
Oct 29 '07 #8
beacon
579 Contributor
Can I use an '&' to tell my DLookup that I need to sort the values by the program they describe? Is that possible?
Oct 29 '07 #9
nico5038
3,080 Recognized Expert Specialist
You should be able to count in a report footer without the additional query by using in the textbox:
Expand|Select|Wrap|Line Numbers
  1. =Count([skilllevel])
  2.  
Nic;o)
Oct 29 '07 #10

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

Similar topics

7
11376
by: Gary | last post by:
I'm using ASP (VB Script) to generate some reports from a SQL Server database. These queries often take a significant amount of time to complete, and many of these reports consist of multiple queries. One of the biggest problems end users have with this is that if the report generation is cancelled (e.g. hitting the stop button on the browser) SQL Server continues to process the request, which usually renders the server unresponsive...
6
6763
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
2
2215
by: Jonathan LaRosa | last post by:
Hi all - I'm wondering if anyone has (or knows of) a tool that will allow me to search through VB code, tables, queries, reports, forms, and other objects, for references to all other types of objects. That's not really that clear, so here's an example: If I have a table named "table_i_would_like_to_delete_but_don't_know_if_any_object_is_using_it",
1
1427
by: j.mandala | last post by:
I have two versions of a database front end and want to be able to use docmd.copy (or some other method) to move a bunch of queries. I was able to use the '.tag' property to of forms and reports to move them using code. For example, first I put the word "Special" in the ..tag property of my reports (or forms), then I use the following procedure: Sub CopyReps()
5
4022
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I think - it might have been XP) to 2003. The database is impressive, both in what it does and the obtuse and inconsistent ways it works. There are several hundred queries, for example, with no indication of where they are used or if they are in fact...
26
2953
by: temp | last post by:
Hi, My boss is asking me to generate a column mapping report of all the queries. Basically, we get our data from ORACLE. There's a queary that create new table from ORACLE tables. Then, there are reports and queries that uses the new table. Is there an add in or tool that can generate mapping reports of the queries.
35
2537
by: NickName | last post by:
I understand it's easy to list all saved queries of a given Access database via Msysobjects system table. However, I have not seen any posting over this NG or other similar ones that also include SQL statement(content) of these queries, though I've noticed some VB code for that. Is that because it's simply impossible to get a query content (not query resultset) from a SQL stmt? Thanks in advance.
2
1843
by: Eric | last post by:
I have an Access 95 database. This database has run for years and now is giving me a problem. When opened, the switchboard works fine and the database functions. However, when I close the switchboard and try to open a table, query or report, the tabs show up for table, query, report and etc. However, the white box that lists the names of the tables, queries, reports does not appear. A small rectangle appears in the upper left hand corner of...
3
1497
by: markxxiv | last post by:
How can I send queries, reports, and perhaps forms for one database via email to a colleague who also has Access 2003 and the same database as the one I'm using to create these queries and reports? I'm using Access 2002, 2003, Windows XP and Yahoo email. How can I send these queries and reports without sending the entire database each time? Thank you for your assistance! Mark / SF Bay Area
5
8108
by: Brett | last post by:
Hello, Is it possible to have just one criteria and have it apply to a group of queries? I am trying to create a report with the separate results of 4 queries based on a prompt for the user to input (only once) a date. Is this something that I program into the report? Also, this is related but may require a separate posting, but can I do
0
8221
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
8162
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
8662
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...
0
8603
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7134
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6104
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
4067
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...
0
4154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1769
muto222
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.