Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Code to adjust query criteria

Discussion in 'Information Technology' started by Francophone, Jul 28, 2006.

  1. Francophone

    Francophone
    Expand Collapse
    Guest

    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?

    TIA
     
  2. Loading...

    Similar Threads Forum Date
    Introducing The Spn Code Of Forum Etiquette Announcements Feb 20, 2016
    UK Sikh 'code of silence' on sexual grooming Breaking News Sep 2, 2013
    Can a Dress Code Bar Ethnic and Religious Attire Based on Customer Preferences in the US? Questions and Answers May 3, 2011
    Pacific Code Exempts Religious Drivers (Fiji) Breaking News Feb 16, 2011
    Controversial Gurdwaras 'Breaking the Sikh Code' on Meat and Alcohol Hard Talk Dec 2, 2010

  3. Ofer Cohen

    Ofer Cohen
    Expand Collapse
    Guest

    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())
    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?
    >
    > TIA
     

Share This Page