473,387 Members | 1,766 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,387 software developers and data experts.

Using a Parameter Query in a Report

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 Name. I then set me.application.tempvars('1") and me.application.tempvars("2") to the Date and Office of interest. In the Open_Report subroutine, I retrieve the two tempvars, and assign them to local variables, which I then reference in the WHERE clause of my SELECT statement. Finally, I open a record set with the SELECT statment, and assign the me.controlsource property of the report to the SELECT. The SELECT stmt is:

slct1 = "SELECT [Sched].skdDate,[sched].skdTime, [sched].Office, [sched].Lname, [sched].Fname, [sched].Phone," _
& " [sched].status FROM Sched WHERE [Sched].skdDate = '" & rptDate & "' AND " _
& " [Sched].Office = '" & rptOffice & "' ORDER BY [Sched].skdTime"

Where rptDate and rptOffice are the parameters to the WHERE clause.

When I execute the SELECT statement in the Open_Report, I get the dreaded
Enter Parameter Value dialog box. The records I need are dependent on the Date and Office that I solicit in the form that executes the report.

How can I accomplish what I want, without getting the EPV dialog box?
Aug 15 '07 #1
3 2268
puppydogbuddy
1,923 Expert 1GB
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 Name. I then set me.application.tempvars('1") and me.application.tempvars("2") to the Date and Office of interest. In the Open_Report subroutine, I retrieve the two tempvars, and assign them to local variables, which I then reference in the WHERE clause of my SELECT statement. Finally, I open a record set with the SELECT statment, and assign the me.controlsource property of the report to the SELECT. The SELECT stmt is:

slct1 = "SELECT [Sched].skdDate,[sched].skdTime, [sched].Office, [sched].Lname, [sched].Fname, [sched].Phone," _
& " [sched].status FROM Sched WHERE [Sched].skdDate = '" & rptDate & "' AND " _
& " [Sched].Office = '" & rptOffice & "' ORDER BY [Sched].skdTime"

Where rptDate and rptOffice are the parameters to the WHERE clause.

When I execute the SELECT statement in the Open_Report, I get the dreaded
Enter Parameter Value dialog box. The records I need are dependent on the Date and Office that I solicit in the form that executes the report.

How can I accomplish what I want, without getting the EPV dialog box?
Try declaring your parameters in the list of parameters, and see if that helps. This is an optional one-time step, but may help Access in determining how to handle the parameters at run time. To declare your parameters, right mouse click on the top part of the query and choose Parameters. A parameter declaration form appears to let you list each parameter name and its type:

--------------------------------------------------------------------------------
Aug 16 '07 #2
You get a message box asking you to enter data when access can't find the reference you are talking about. I have run into this sort of thing when I have renamed complex queries based off of queries.
The first thing I'd check is the spelling of all the tables, sub-queries and fields referenced to make sure it matches.

Bottom line, I think is you are pointing Access to a table or query definition that it can't find because either the name doesn't match or you have omitted a field that you are referencing.
Aug 16 '07 #3
Dear all i have a problem
i have a database is set it there . but i want to create a report which i can choose the date for example, before i get the report i want to write the date like from 12-12-2006 to 12-10-207 and then display the details in these perioud of time is that possible , the date will be change ..
it is urgent , plz any one can help
Aug 16 '07 #4

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

Similar topics

1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
1
by: Nicolae Fieraru | last post by:
Hi All, I want to find if there is a different way than the way I am working now. Lets say I have a table, tblCustomers containing address details. I want a report with all the customers from...
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: amith.srinivas | last post by:
Hi all, From a word macro in VBA, I am trying to create a report in access DB. The report is based on a query with a parameter. I am using Set rpt = Application.CreateReport rpt.RecordSource =...
2
by: Roger | last post by:
Anyone know how to pass a parameter to a query via a report in Access 2003?
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" ...
3
by: njgreen2001 | last post by:
I am attempting an access database which tracks blood components in our medical facility. When a component is issued to a patient there is a button to push which links to a report that runs a...
6
by: fieldja | last post by:
I have a form called OwnerForm. It contains a combo box called Owner. The combo box looks up names from a table called OwnerName. It contains fields called OwnerID and Owner. I also have a main...
1
by: yoursteveis | last post by:
Dear all, I have created a main report (for monthly purchase summary) and a sub report (for monthly sales summary). I have linked main report with a parameter query (i.e. purchasesummary1) and...
25
by: DanicaDear | last post by:
I am trying my hand at my first ever Access report. It is based on a two parameter query (start date, end date). When I use the report wizard and click "view report" the report prompts me for the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.