Date

J

Jamie

I want to set a date function on the main menu form so a user can specify a
beginning and end date and a report will show data only from that time
period. If they choose another report I would want the date to still be there
so they don't have to enter it again. Any suggestions.
 
J

jleckrone

Create two text boxes for your Begin and End Date. Then when you run
your reports, have the report refer to the field on your form ie
Between Forms!MainForm!BeginDate And Forms!MainForm!EndDate

Hope that helps!
 
O

Ofer Cohen

Hi Jamie
On the main form create two text boxes for the Date input, then use the
Where condition of the report Open command line

Dim MyWhereCondition As String
MyWhereCondition = "[DateFieldName] Between #" & Me.[StartDateTextBox] & "#
And #" & Me.[EndDateTextBox] & "#"
Docmd.OpenReport "ReportName" , , , MyWhereCondition
 
D

Douglas J. Steele

Just be aware that if your Short Date format is dd/mm/yyyy, that will not
work correctly for the first 12 days of each month.

Safer is:

MyWhereCondition = "[DateFieldName] Between " & _
Format(Me.[StartDateTextBox], "\#mm\/dd\/yyyy\#") & _
" And " & Format(Me.[EndDateTextBox], "\#mm\/dd\/yyyy\#")


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ofer Cohen said:
Hi Jamie
On the main form create two text boxes for the Date input, then use the
Where condition of the report Open command line

Dim MyWhereCondition As String
MyWhereCondition = "[DateFieldName] Between #" & Me.[StartDateTextBox] & "#
And #" & Me.[EndDateTextBox] & "#"
Docmd.OpenReport "ReportName" , , , MyWhereCondition

--
Good Luck
BS"D


Jamie said:
I want to set a date function on the main menu form so a user can specify a
beginning and end date and a report will show data only from that time
period. If they choose another report I would want the date to still be there
so they don't have to enter it again. Any suggestions.
 
Top