Data Range on a Form~!~

LaRockera02

Registered User.
Local time
Today, 07:32
Joined
Oct 21, 2011
Messages
83
Hi,
I need help in creating a date range for a form. Based on the dates selected I want to generate a report. I'm assuming there's some VBA coding needed and two text boxes.

Please Help,

thanks
 
If you have a query as the record source for your report then no coding would be necessary for filtering your report using a range of date as you can designate the controls on your form as the criteria in your query.
 
I'm getting it out of a query. but I'm not entirely sure on how to do this. what do I write under criteria, in the query?

and Since I only have one Date on the query, am I going to need two since I'm going to have a Start and End Date?
 
With your query in design view and your cursor in the criteria row of your date field, right click and select the "Builder" option. Add the "Between" operator first and then use the options available from the Builder to locate and specify the two controls that will have the two dates (the starting and ending dates) you need for the criteria.
 
Builder to locate and specify the two controls that will have the two dates (the starting and ending dates) you need for the criteria.
__________________

How do i do that?
 
LOL I just sent you a private messge vBaInet. I'm not sure if this is what I'm looking for or this is quite confusing. Can you explain to me how exactly do I implement this?

I only have one date text box, unless I'm suppose to make two?
 
Lol yes I noticed ;)

1. What is the name of the textbox?
2. What is the data type of the field you are filtering against?
 
Certainly what vbaInet has suggested will also work. But, I was assuming that you have two text box controls on your form where you could provide a starting and ending date which would constitute a "date range" which is what you indicated in your original post that you wanted.
 
@Mr. B: I would have thought the same since he/she mentioned it here too:
and Since I only have one Date on the query, am I going to need two since I'm going to have a Start and End Date?

@LaRockera02: You need two textboxes, one for the Start Date and the other for the End Date. Name them appropriately.
 
Mr. B is correct. I want the user to be able to choose between the Start and End date
 
Good names :)
Code:
DoCmd.OpenReport "[COLOR=Red]ReportName[/COLOR]", acViewPreview,, "[[COLOR=Red]DateField[/COLOR]] BETWEEN #" & Me.txtBegDate & "# AND #" & Me.txtEndDate & "#"
Amend the red bits.
 
DoCmd.OpenReport "SearchCallDat", acViewPreview,, "[myDate] BETWEEN #" & Me.txtBegDate & "# AND #" & Me.txtEndDate & "#"

I'm assuming you meant by this
"[DateField]
the name of the data field on the form?
 
The name of the date field in the form or report you will like to filter.
 
Date is not a good field name. It's an Access reserved keyword.

If you keep using Date you will have to enclose it in square brackets, like so [Date]
 
I know I learned it from last time lol the problem is that I wasn't the one who made it so I've constantly have to change things around.

I renamed it to: txtDATE,

Houw you feel about that?
 
I feel sad about that :( :D

txtDate is what you will normally use for a textbox because of the txt part. Rename it something more meaningful.
 

Users who are viewing this thread

Back
Top Bottom