Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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!
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top