469,125 Members | 1,777 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,125 developers. It's quick & easy.

Filter report by date greater than inputbox value

I am trying to view a report that has records that are filtered by date. basically all of the records that are greater than whatever date is entered into an input box. I would actually like to know how to give a start and an end date, but i figured i might be able to master that once i get the first code down. Here is what i cam currently using. ncrdate is a field from my table.
Expand|Select|Wrap|Line Numbers
  1.     Dim stDocName As String
  2.     Dim mydate
  3.     Dim myval As String
  5.  myval = InputBox("Please enter the start date.")
  6.  mydate = DateValue(myval)
  7.  MsgBox (mydate) 'I was just using this to make sure that it was reported as an actual date
  9.     stDocName = "rptNCRSpread"
  10.     DoCmd.OpenReport stDocName, acPreview, , "ncrdate > myval"
Any help is greatly appreciated. I hope this question isnt too silly.
Feb 14 '09 #1
2 4085
32,161 Expert Mod 16PB
You're pretty close.

The string should be :
Expand|Select|Wrap|Line Numbers
  1. "[ncrdate]>" & Format(myval,"\#m/d/yyyy\#")
PS. It's only THAT complicated because it's a date. See Literal DateTimes and Their Delimiters (#).
Feb 15 '09 #2
Thanks, worked like a charm
Feb 19 '09 #3

Post your reply

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

Similar topics

5 posts views Thread by Jim Fox | last post: by
reply views Thread by CSDunn | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.