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

How to filter a repor with a textbox value on the report

I have a report which is based on a querry i created in access. The report has a date field. on the report, I have two text boxes labled "FROM" and "TO" respectively. and the a button labled "FILTER".
I want the report to show only records which date field falls within the date value "FROM" textbox and the "TO" textbox
Aug 7 '12 #1
3 6069
twinnyfo
3,653 Expert Mod 2GB
King JOT,

If I understand your question properly, the following code, initiated by clicking the Filter button should work:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub cmdFilter_Click()
  5. On Error GoTo EH
  6.     Me.Filter = "Date >= #" & Me.txtFROM & _
  7.         "# AND Date <= #" & Me.txtTO & "#"
  8.     Me.FilterOn = True
  9.     Exit Sub
  10. EH:
  11.     MsgBox Err.Number & " " & Err.Description
  12. End Sub
  13.  
Please let me know if this helps.
Aug 7 '12 #2
zmbd
5,501 Expert Mod 4TB
Why are you doing the filter in the report?
Create a form with the from and to dates in two text fields and a button to run the report.
You can use some VBA to validate the dates
Then use a parameter based query refering back to the form as the record source for your report.
When you open the report, the form will open, user enters the dates and the report runs...
I use the onclose event of the report to close the form.

Step by Step example is here:
http://office.microsoft.com/en-us/ac...001117077.aspx

-z
Aug 9 '12 #3
zmbd
5,501 Expert Mod 4TB
Moderator's Note:
Do to a recent round of unrelated posts to this thread, any further posts to this thread need to be in direct address to King JOT original post or provide some additional helpful information such as a new feature, or one that was overlooked.

Other non-related posts will be removed and treated as spam/thread-hijack.

-Z
Oct 17 '14 #4

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

Similar topics

1
by: RockNRoll | last post by:
I'm new to ASP.NET and need to filter a datagrid based on a textbox value. I have a working datagrid and would like the WHERE part of my SQL statement to call the value of a textbox and refresh...
2
by: Raed Sawalha | last post by:
Hi, This is probably pretty simple but... I am dynamically adding rows to a HtmlTable that contain Textbox controls. (There may be more than one server control/textbox in a given cell) How...
2
by: Atreju | last post by:
Ok I got form within a c sharp page. Situation: On the form I have a drop downliwst and a textbox, the dropdownlist is populated with products and the textbox has a default vale of the product...
2
by: Nowezo | last post by:
Hi, Can you please help me, I want to write a dropdown box that have an option 'Other' but when the Other is selected my textbox need to be enable and take the textbox value as an output instead of...
3
by: MLH | last post by:
Textbox on report displays year (1991) in scientific notation if I raise the font size in that control to above 16 points. It seems Access 'thinks' 1991 is too big to display properly in the...
1
by: viral123 | last post by:
Hi all I am using Crystal report and I am running my report successfully for my query but I want to make my query for one specific date. I want to get the date value from the textbox value. ...
2
by: Archanak | last post by:
Hi, I have one common text box to get email id. I have 2 forms and both form action connects to different programs. I want to use this textbox value(i.e email id) only for both the forms. How...
10
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value...
1
by: visweswaran2830 | last post by:
Hi, I have datagrid control. In that I place textbox, insert link button in hearder template. When I click that Insert button the value from textbox should be loaded into grid. I am capturing at...
0
by: yogarajan | last post by:
Hi All I am create textbox and collect textbox value at runtime using c# my aspx code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <!DOCTYPE html...
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
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...
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
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.