Connie-
Don't you really want to do:
DoCmd.OpenForm "Search_SoldAttributes", , , "SoldDate >= #" & dtYrAgo & "#"
??
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
----------------------------------
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of mrsgoudge
Sent: Thursday, May 24, 2012 11:37 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Records filtered for one year ago
Hi all,
I have a continuous form with a filter by form header. Upon opening the form I
would like to filter it so that only the last year's worth of records show and
have the StartSoldDate txtbox in the header have the current date - 1 year. I
have the header box working (I'm just putting in the date but not creating a new
filter since it would load completely and then refilter).
The textbox in the form is SoldDate. I can't get it to filter upon loading.
Here's my code:
Dim dtYrAgo As Date
dtYrAgo = DateAdd("yyyy", -1, Date)
DoCmd.OpenForm "Search_SoldAttributes", , , "SoldDate = #" & dtYrAgo & "#"
Forms!Search_SoldAttributes.tbSoldStartDate = dtYrAgo
Thanks for you help!
Connie
Kamis, 24 Mei 2012
RE: [MS_AccessPros] Records filtered for one year ago
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar