Report for all records with end date greater than today

G

Guest

I am trying to pull up a report that will filter out any records where a data
field, Date_End, is less than the current date. The user will enter
information and indication a start date and end for the record. I want to be
able to generate a daily report with all records where the current date falls
between the start and end date the user entered. I figured the easiest way
to do this would be to simply only pull in any record where the DATE_END
value is greater than the current Date.
Below is what I have and it does not seem to work. I assume since DATE_END
is a recordset, I must not be calling that data correctly.

Dim strwhere As String

strwhere = "[Date_End] >= Date()"

DoCmd.OpenReport "Rpt_DailyEvents", acViewPreview, , strwhere

Any help would be appreciated.
 
A

Allen Browne

Try concatenating the value into the string:
strwhere = "[Date_End] >= " & Format(Date, "\#mm\/dd\/yyyy\#")

The explicit formatting ensures it works regardless of the user's regional
settings.
 
G

Guest

Worked Beautifully.
Thank you

Allen Browne said:
Try concatenating the value into the string:
strwhere = "[Date_End] >= " & Format(Date, "\#mm\/dd\/yyyy\#")

The explicit formatting ensures it works regardless of the user's regional
settings.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Todd said:
I am trying to pull up a report that will filter out any records where a
data
field, Date_End, is less than the current date. The user will enter
information and indication a start date and end for the record. I want to
be
able to generate a daily report with all records where the current date
falls
between the start and end date the user entered. I figured the easiest
way
to do this would be to simply only pull in any record where the DATE_END
value is greater than the current Date.
Below is what I have and it does not seem to work. I assume since
DATE_END is a recordset, I must not be calling that data correctly.

Dim strwhere As String
strwhere = "[Date_End] >= Date()"
DoCmd.OpenReport "Rpt_DailyEvents", acViewPreview, , strwhere

Any help would be appreciated.
 

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

Top