473,789 Members | 2,500 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass parameters from Form to Reports?

1 New Member
Hi

I want to ask...

A report is using a query as record source.
That query has parameters [StartDate] and [EndDate].
A command button in a form open that report.
That form contains 2 textbox for date.

How can I pass this 2 textbox as the parameters of the query?

Query:
SELECT * FROM Orders WHERE Orders.[Date/Time] Between [StartDate] And [EndDate]

I am still learning MS Access, so please tell me if there is another way...
Feb 8 '07 #1
3 5254
MMcCarthy
14,534 Recognized Expert Moderator MVP
Change report query to ...

Expand|Select|Wrap|Line Numbers
  1.  SELECT * FROM Orders;
Command button to open the report
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdBtnName_Click()
  2. Dim stDocName As String
  3. Dim stLinkCriteria As String
  4.  
  5.   stDocName = "ReportName"
  6.   stLinkCriteria = "[Date/Time] Between " & Me.StartDate & " And " & Me.EndDate
  7.   DoCmd.OpenReport stDocName, , , stLinkCriteria
  8.  
  9. End Sub
  10.  
Feb 8 '07 #2
nico5038
3,080 Recognized Expert Specialist
Just adding to the above comment that you need to construct a form with two textboxes, named Startdate and EndDate (See the Name property under the Other tab of the properties for those fields) and a button to trigger the code.

Nic;o)
Feb 8 '07 #3
NeoPa
32,579 Recognized Expert Moderator MVP
You should replace the stLinkCriteria line of Mary's code with :
Expand|Select|Wrap|Line Numbers
  1.   stLinkCriteria = "[Date/Time] Between " & _
  2.                    Format(Me!StartDate,"\#m/d/yyyy\#") & _
  3.                    " And " & _
  4.                    Format(Me!EndDate,"\#m/d/yyyy\#")
Feb 10 '07 #4

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

Similar topics

1
2917
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access 2000. The access file is in access 2000 format. I have a form that will hold the relevent parameters for the query/report that reports the statistics for all job records that match a certain criteria. These are: - A Customer Name.
7
21636
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
0
3323
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems appear when someone is trying to use it as front-end for real server database systems such as PostgreSQL or MySQL. One of these problems is regarding pass-through queries and parameters. I wanted to have all the code on client, while executing it on...
9
12875
by: Jay Douglas | last post by:
Hello, I am needing to pass a class object (this) by reference to a method in a different class. When I do the following code I get the error (Cannot pass '<this>' as a ref or out argument because it is read-only) .. Is there any way to make <this> not read-only? I have simplified the following code. There is a Task class and a Data Class. I am trying to pass the task class by ref to the data class. public class Task {
9
7153
by: Robert Schuldenfrei | last post by:
Hello NG, After a bit of a wait my bookstore, SoftPro of Waltham, MA, got in the Brian Bischof book: Crystal Reports .NET Programming. I have read a few books on CR, but I am very new to it, C#, and SQL. The book is excellent. Undaunted, I have plowed into a conversion of my old COBOL ERP system, MCS-3, into C#. I have quite a bit of Inventory Control done and working. For reports I am trying to use CR. I have a half a dozen of them...
3
2254
by: Don Wash | last post by:
Hi There! I've posted a few days back about this issue but no solutions has been found and that's why I'm re-posting this. I'm using built-in CrystalReport that comes with VS.NET 2003 to create reports for use it ASP.NET. How do I configure a graph in the Report (*.rpt file) so that I can pass the SQL Query as an argument from ASP.NET Application? I know that I can define
3
1953
by: Nancy | last post by:
I have the following scenario. I have some Crystal Reports that were created outside the .NET Visual Studio. These reports were designed to enter date parameters. I have developed a ASP.NET app to display these reports. I am succesfull when there is no parameters. But, Is there a function in .NET to automatically display the Crystal Report Paramenter Form?
2
3182
by: Dean Slindee | last post by:
I would like to pass multiple parameters from a VB.NET application to an existing Access 2003 application's reports (essentially using Access as a report writer where the reports already exist). The reports' datasource is a stored procedure with multiple @parameters. This code works where the report requires no parameter: Dim strAccessDBPath As String Dim booReturn As Boolean = False strReportName = "rptCMOTeam1" strAccessDBPath =...
0
1370
by: Dean Slindee | last post by:
I would like to pass multiple parameters from a VB.NET application to an existing Access 2003 application's reports (essentially using Access as a report writer where the reports already exist). The reports' datasource is a stored procedure with multiple @parameters. This code works where the report requires no parameter: Dim strAccessDBPath As String Dim booReturn As Boolean = False strReportName = "rptCMOTeam1" strAccessDBPath =...
0
9663
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
9511
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
10404
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...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5415
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
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.