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

Custom parameter dialog box for query/report

beacon
579 512MB
Hi everybody,

[Access 2003]

I've created custom parameter dialog boxes before that will call a report, which calls the underlying query, and passes the parameters accordingly, but I'm having trouble with one that I'm currently working on because it's slightly different than the others.

Here are the query definitions:
Expand|Select|Wrap|Line Numbers
  1. Query 1 - qryAuditorsReview (This query is used to compile data)
  2.  
  3. Field: AuditorFullName
  4. Field: Campus
  5. Field: PatientMPI
  6. Field: DischargeDate
  7. Field: DatePIAReceived
  8. Field: DateAudited
  9. Expression: NotAuditedTimely (This expression returns a 1 or 0 for timeliness, and is based on the DischargeDate, DatePIAReceived, and DateAudited fields)
  10.  
Expand|Select|Wrap|Line Numbers
  1. Query 2 - qryAuditorsTotalReview (This query is used to summarize the data in qryAuditorsReview)
  2.  
  3. Field: AuditorFullName
  4. Field: Campus
  5. Field: TotalCharts (Count of PatientMPI)
  6. Field: NotAuditedTimely (Sum of NotAuditedTimely)
  7.  
I'm created my report, rptDataAnalystProductivity, with qryAuditorsTotalReview as the record source, and I've created my unbound form, frmReportDataAnalystProductivity. The form has 3 fields: BeginningDate (textbox), EndingDate (textbox), and Campus (combo box with 2 values from control source 'qryCampus'). I've set up parameter criteria in qryAuditorReview (the 1st query) for each of the 3 fields on the form so that the query can retrieve the values and the report will run according to those parameters.

Basically, my report is dependent on qryAuditorsTotalReview, and qryAuditorsTotalReview is dependent on qryAuditorsReview to get the parameters from the form. The issue I'm running into is that the report will return no data if I run it using the form. I can run both queries and return data, and can run the report by itself and return data, but the form says that no data is returned.

I played around with the queries and found that if I remove Campus from both of the queries, that the form will run successfully. However, if I remove Campus from only one query (doesn't matter which one), the form won't run. It's like the form is passing the Campus parameter, which sucks because I really need Campus to work in order to filter the data properly.

Anyone have any ideas what I'm doing wrong?
Jan 28 '10 #1

✓ answered by TheSmileyCoder

Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.Campus)=[Forms]![frmReportDataAnalystProductivity]![Campus]))
I think is the issue. Let me guess that your combobox on the form has a hidden first column (zero-width column) containing the CampusID. Even though the field is hidden from human view, the code will always take the first column, as that is the actual "value" stored in that field, the other is just displayed information.
Either do:
Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.CampusID)=[Forms]![frmReportDataAnalystProductivity]![Campus]))
Or
Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.Campus)=[Forms]![frmReportDataAnalystProductivity]![Campus].Column(1)))
First column is 0

Id suggest also naming the combobox something like cboCampus or cmbCampus, that makes you realise when doing queries like these that your dealing with a combobox, and might need to look at the stored value and not the displayed one.

Let me know if this was the problem, and if these hints solved it.

6 4439
TheSmileyCoder
2,322 Expert Mod 2GB
Whats the SQL syntax for the queries?
Jan 28 '10 #2
beacon
579 512MB
Query 1 - qryAuditorsReview
Expand|Select|Wrap|Line Numbers
  1. SELECT qryAuditorsActive.AuditorFullName, qryPatientDetail.PatientMPI, qryPatientDetail.Episode, qryPatientDetail.DischargeDate, qryCampus.Campus, qryPatientDetail.DatePIAReceived, qryPatientDetail.DateAudited, DateDiff("d",[DischargeDate],[DateAudited]) AS DaysSinceDischarge, DateDiff("d",[DischargeDate],[DatePIAReceived]) AS DaysToReceivePIA, DateDiff("d",[DatePIAReceived],[DateAudited]) AS DaysToAudit, DateDiff("d",[DatePiaReceived],[30Day]) AS Received30Day, DateAdd("d",30,[DischargeDate]) AS 30Day, IIf(([DaysToReceivePIA]>30),0,IIf(([DaysToReceivePIA]<=30) And (([DaysToReceivePIA]+[DaysToAudit])<=30),0,1)) AS NotAuditedTimely
  2. FROM (qryPatientDetail INNER JOIN qryAuditorsActive ON qryPatientDetail.AuditorIDFK = qryAuditorsActive.AuditorID) INNER JOIN qryCampus ON qryAuditorsActive.CampusIDFK = qryCampus.CampusID
  3. WHERE (((qryPatientDetail.DischargeDate) Between [Forms]![frmReportDataAnalystProductivity]![BeginningDate] And [Forms]![frmReportDataAnalystProductivity]![EndingDate]) AND ((qryCampus.Campus)=[Forms]![frmReportDataAnalystProductivity]![Campus]));
  4.  
Query 2 - qryAuditorsTotalReview
Expand|Select|Wrap|Line Numbers
  1. SELECT qryAuditorsReview.AuditorFullName, qryAuditorsReview.Campus, Count(qryAuditorsReview.PatientMPI) AS TotalCharts, Sum(qryAuditorsReview.NotAuditedTimely) AS NotAuditedTimely
  2. FROM qryAuditorsReview
  3. GROUP BY qryAuditorsReview.AuditorFullName, qryAuditorsReview.Campus;
  4.  
Thanks and let me know if you need me to provide anything else (VBA, Form screen shot, a half-eaten cookie, etc.)
Jan 28 '10 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.Campus)=[Forms]![frmReportDataAnalystProductivity]![Campus]))
I think is the issue. Let me guess that your combobox on the form has a hidden first column (zero-width column) containing the CampusID. Even though the field is hidden from human view, the code will always take the first column, as that is the actual "value" stored in that field, the other is just displayed information.
Either do:
Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.CampusID)=[Forms]![frmReportDataAnalystProductivity]![Campus]))
Or
Expand|Select|Wrap|Line Numbers
  1. ((qryCampus.Campus)=[Forms]![frmReportDataAnalystProductivity]![Campus].Column(1)))
First column is 0

Id suggest also naming the combobox something like cboCampus or cmbCampus, that makes you realise when doing queries like these that your dealing with a combobox, and might need to look at the stored value and not the displayed one.

Let me know if this was the problem, and if these hints solved it.
Jan 29 '10 #4
beacon
579 512MB
All I have to say is wow! Good guess...

I tried changing my query to match what you provided, but neither worked. However, it did get me thinking about the bound column that I was using for the combo box, which was the first column. I changed that to the second column and everything worked out perfect...can't believe I overlooked that when I was creating the form.

I usually do what you suggested, but didn't for this query/form/report because it's the first one I've written where I've had to use Campus for anything...but I will go back and change it to match up with my other fields when I go back in to document my VBA.

Thanks for your help Smiley!

~beacon
Jan 29 '10 #5
NeoPa
32,556 Expert Mod 16PB
@TheSmileyOne
I would only comment on this particular point in an otherwise perfect and helpful answer.

The first column is the Bound Column by default, yet any column can be set this way by changing this property in Design View. The value will always reflect this column (Bound Column).
Jan 30 '10 #6
TheSmileyCoder
2,322 Expert Mod 2GB
Guess I learned something too then :)
Jan 31 '10 #7

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

Similar topics

2
by: RBohannon | last post by:
I have a report with most fields populated by a query. However, some of the fields are variable in such a way that their values cannot be queried from a table. At present the values for these...
4
by: Theo Jansen | last post by:
Hi, i'm making an application in Access and in the query made, i'd like the user to fill in a parameter when opening the query (in a report). It's much easier for the user if the parameter was a...
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: Roger | last post by:
Anyone know how to pass a parameter to a query via a report in Access 2003?
2
by: Miguel | last post by:
I have followed the advice noted throughout this group for capturing parameter values in a report header. It works, but the parameter dialog box appears twice,once for the query and once for the...
5
by: teddysnips | last post by:
I have been asked to look at an Access application. It generates a report successfully, so that you can see it on the screen with no errors. However, when you try to print it, the prompt dialog...
6
by: Brewtzaff | last post by:
Hello, I have a little problem to print my reports on custom sized paper. I got a db containing clubmembers, a query which selects only the needed infos to print out my membershipcards. My...
3
by: PaganChant | last post by:
I have written a report that lists the Patient Id, phone number &ct, for a specific Dr's office and a specific date.To execute the report and attendant query, I use a form to get the Date and Office...
1
by: waltnixon | last post by:
I've got an MS Access query which runs fine when double clicked and returns all of the rows in a test database I'm building. I've set up a multi group report based on the query. I immediately...
2
by: PotatoChip | last post by:
I am working in Access 2002 and I have been asked to create a form for a report based on a paramter query so that the user selects the department from a drop down list on the form, query runs and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...

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.