473,404 Members | 2,174 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,404 software developers and data experts.

Report underlying query

121 100+
Hi

I have a report with an underlying query. The criteria in the query points to three different controls on a form. The user has to select client name, start date and end date. I want to be able to let the user select just the client name, and not the start and end dates, then run the report, as well as selecting client name, start and end date. Is this possible?

Regards Phill
Expand|Select|Wrap|Line Numbers
  1. SELECT T_ClientDetails.ClientID AS T_ClientDetails_ClientID, T_ActiveSession.SessionID, T_ActiveSession.ClientID AS T_Session_ClientID, T_ClientDetails.FirstName, T_ClientDetails.LastName, T_ClientDetails.Title, T_ClientDetails.OrganizationName, T_ActiveSession.ProjID, T_ArtistProj.ProjBandName, T_Studio.StudioName, T_Studio.StudioDesc, T_ActiveSession.StartDate, T_ActiveSession.EndDate, T_ActiveSession.StartTime, T_ActiveSession.EndTime, T_SessRate.Rate, T_ActiveSession.SessComplete, DateDiff("n",[starttime],[endtime]) AS DateDiffEXP, [datediffexp]\60 & Format([datediffexp] Mod 60,"\:00") AS DateDiffFormatExp, [Rate]/60*[datediffexp] AS TotalExVATExp, Round([vatvalue]/100*[TotalExVATExp],2) AS VATExpr, [TotalExVATExp]+[VATExpr] AS TotalIncVATExpr, T_VATValue.VATValue, T_ArtistProj.ProjectDesc
  2. FROM T_VATValue, T_ClientDetails INNER JOIN (T_Studio INNER JOIN (T_SessRate INNER JOIN (T_ArtistProj INNER JOIN T_ActiveSession ON T_ArtistProj.ProjBandID = T_ActiveSession.ProjID) ON T_SessRate.SessRateID = T_ActiveSession.SessRateID) ON T_Studio.StudioID = T_ActiveSession.StudioID) ON T_ClientDetails.ClientID = T_ActiveSession.ClientID
  3. GROUP BY T_ClientDetails.ClientID, T_ActiveSession.SessionID, T_ActiveSession.ClientID, T_ClientDetails.FirstName, T_ClientDetails.LastName, T_ClientDetails.Title, T_ClientDetails.OrganizationName, T_ActiveSession.ProjID, T_ArtistProj.ProjBandName, T_Studio.StudioName, T_Studio.StudioDesc, T_ActiveSession.StartDate, T_ActiveSession.EndDate, T_ActiveSession.StartTime, T_ActiveSession.EndTime, T_SessRate.Rate, T_ActiveSession.SessComplete, T_VATValue.VATValue, T_ArtistProj.ProjectDesc
  4. HAVING (((T_ClientDetails.ClientID) Like [Forms]![F_ClientSessDRange].[combo7]) AND ((T_ActiveSession.StartDate)>=[forms]![f_ClientSessDrange]![BeginDate] And (T_ActiveSession.StartDate)<=[forms]![f_ClientSessDrange]![EndDate]) AND ((T_ActiveSession.SessComplete)=True));
  5.  
Feb 26 '09 #1
6 1685
phill86
121 100+
Also is there a way to view all the clients so in the combo box there would be a record that says All Clients

Cheers Phill
Feb 26 '09 #2
NeoPa
32,556 Expert Mod 16PB
Try replacing line #4 with :
Expand|Select|Wrap|Line Numbers
  1. HAVING ((T_ClientDetails.ClientID Like [Forms]![F_ClientSessDRange].[combo7])
  2.    AND  (T_ActiveSession.StartDate Between Nz([Forms]![f_ClientSessDrange]![BeginDate],#1/1/1900#)
  3.                                    And     Nz([Forms]![f_ClientSessDrange]![EndDate],#12/31/9999#)
  4.    AND  (T_ActiveSession.SessComplete))
Feb 26 '09 #3
NeoPa
32,556 Expert Mod 16PB
Alternatively, it's possible to open a Report, specifying a WhereCondition parameter that filters it on-the-fly.

For the record, I suggest you clear the date and client filtering from the query itself, and build a string dynamically in your code.
Feb 26 '09 #4
phill86
121 100+
Thanks Neopa great help
Feb 26 '09 #5
NeoPa
32,556 Expert Mod 16PB
@phill86
Yes.

If you specify the RecordSource of the ComboBox as having an extra column which is set to be the default returned value of the control, but is not visible, You would need to ensure the value matching the "All Clients" entry is set to "*".
Feb 26 '09 #6
OldBirdman
675 512MB
Also is there a way to view all the clients so in the combo box there would be a record that says All Clients
I'm assuming the ComboBox has 2 columns, ID and Name, that ID is a key. and you mean row, not record, in "...be a record that...". The following SQL statement illustrates how such a combo might be filled. The WHERE clause is for illustration, and might not be needed.
Expand|Select|Wrap|Line Numbers
  1. SELECT tClients.Key AS ID, tClients.Name AS Name
  2. FROM tClients
  3. WHERE (((tClients.Key)<10)) UNION SELECT -1 AS ID, "<<Select All>>" AS Name FROM tClients ORDER BY Name;
Test for combobox.value = -1 to see if "<<Select All>>" chosen.
Feb 26 '09 #7

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

Similar topics

2
by: Matt. | last post by:
Hi All! Is it possible to export an Access Report? Not the report that is produced when the report is run, but the actual framework, or source, of the report. I'm trying to debug a report I...
1
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
2
by: SJM | last post by:
I have a report that displays records of real estate properties. It is possible for each property to appear a number of times for various reasons. Each record however is unique. What I would like...
1
by: Chasing Gates | last post by:
I have created a database that brings in a new table weekly. I then made a separate query for each sales rep and a separate report for each rep. (The reports are all identical but call different...
2
by: Tom | last post by:
This is related to an earlier post entitled "Text in Query/Numbers in Report" Brief recap - report has a query as a record source. The query shows the correct data, the report translating the...
0
by: Chris | last post by:
I have the following situation in a VB.Net App I am working on: 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. 2.)The datasource for the report is a Stored Proc in a...
1
by: tom | last post by:
Is it possible to have a report with prompts/parameters, but without an underlying query? I've seen varying posts related to this, but I'm not seeing a concete answer. As I understand it, to make a...
5
by: David L. | last post by:
I'm running into a frustrating problem. ASP.NET 2.0 web application, against SQL'05, I'm trying to run a report against a 'table provider' (query) that excutes well within SQL MGT studio, and...
4
by: Jimmy | last post by:
I have a form with a command button on it that is supposed to open up a report and use a query to populate it. DoCmd.OpenReport "rptMailingList", acViewPreview, "qryMailingListChristmas" ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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
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...

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.