206f Sikh Philosophy Network - View Single Post - Code to adjust query criteria
View Single Post
  #2 (permalink)  
Old 28-Jul-2006, 08:34 AM
Ofer Cohen's Avatar Ofer Cohen
Guest
 
Posts: n/a
   
   
RE: Code to adjust query criteria

If the filter are used for reports, you can use the WhereCondition section on
the OpenReport command line

Dim MyCondition As String
MyCondition = "Year([DateFieldName]) = " & Year(Date())
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/13149-code-to-adjust-query-criteria.html
Docmd.OpenReport "ReportName" , , , MyCondition

--
Good Luck
BS"D


"Francophone" wrote:

> Currently I have a switchboard for printing reports that track performance
> over:
> 1. the current month
> 2. the previous 90 days
> 3. the current year
>
> The way I am doing this is by creating 3 different queries for those time
> periods and referencing those to create the 3 different reports via 3 control
> buttons.
> (ie. >=DateSerial(Year(Date()),1,1) - for current year)
>
> I think I can better do this by writing code for the 3 control buttons and
> automatically setting the 3 different criterias for the queries. Problem is
> I don't know how to do this. Can anyone please help?
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13149
>
> TIA

Reply With Quote
 
Page generated in 0.14901 seconds with 25 queries
0