By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

Filter report by date greater than inputbox value

P: 31
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
  4.  
  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
  8.  
  9.     stDocName = "rptNCRSpread"
  10.     DoCmd.OpenReport stDocName, acPreview, , "ncrdate > myval"
  11.  
Any help is greatly appreciated. I hope this question isnt too silly.
Feb 14 '09 #1
Share this Question
Share on Google+
2 Replies


NeoPa
Expert Mod 15k+
P: 31,418
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

P: 31
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.