|
 |
access thread: Query criteria expression
Message #1 by "Andrew Payne" <andrew@p...> on Fri, 13 Dec 2002 12:08:13
|
|
I have a query that I want to filter by date. The table I'm taking the
data from has a DateEntered field, in the query I want only those rows
where the DateEntered >= current date - 10 days. I have tried entering
various expressions into the relevant criteria box for the query but have
so far not found the right one, could someone please tell me the correct
expression for this.
Thanks Andrew
Message #2 by "John Ruff" <papparuff@a...> on Fri, 13 Dec 2002 04:07:12 -0800
|
|
In the criteria field beneath the DateEntered field enter the following
>=Dateadd("d",-10,Date())
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
www.noclassroom.com
Live software training
Right over the Internet
Home: xxx.xxx.xxxx
Cell: 253.307/2947
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: Andrew Payne [mailto:andrew@p...]
Sent: Friday, December 13, 2002 12:08 PM
To: Access
Subject: [access] Query criteria expression
I have a query that I want to filter by date. The table I'm taking the
data from has a DateEntered field, in the query I want only those rows
where the DateEntered >= current date - 10 days. I have tried entering
various expressions into the relevant criteria box for the query but have
so far not found the right one, could someone please tell me the correct
expression for this.
Thanks Andrew
Message #3 by joe.dunn@c... on Fri, 13 Dec 2002 12:09:53 +0000
|
|
Look up help on DATEDIFF - you need to calculate the DATEDIFF between
DateEntered and current date - i.e. Date().
This function can be used to set up an expression in the query which can be
tested for equal to or greater than 10 days
"Andrew Payne"
<andrew@p... To: "Access" <access@p...>
tics.co.uk> cc:
Subject: [access] Query criteria expression
13/12/2002 12:08
Please respond to
"Access"
I have a query that I want to filter by date. The table I'm taking the
data from has a DateEntered field, in the query I want only those rows
where the DateEntered >= current date - 10 days. I have tried entering
various expressions into the relevant criteria box for the query but have
so far not found the right one, could someone please tell me the correct
expression for this.
Thanks Andrew
*************************************************************************
This e-mail may contain confidential information or be privileged. It is intended to be read and used only by the named
recipient(s).
If you are not the intended recipient(s) please notify us immediately so that we can make arrangements for its return: you should
not disclose the
contents of this e-mail to any other person, or take any copies. Unless stated otherwise by an authorised individual, nothing
contained in this e-mail is
intended to create binding legal obligations between us and opinions expressed are those of the individual author.
The CIS marketing group, which is regulated for Investment Business by the Personal Investment Authority, includes:
Co-operative Insurance Society Limited Registered in England number 3615R - for life assurance and pensions
CIS Unit Managers Limited Registered in England and Wales number 2369965 (also regulated by IMRO) - for unit trusts and PEPs
CIS Policyholder Services Limited Registered in England and Wales number 3390839 - for ISAs and investment products bearing the CIS
name
Registered offices: Miller Street, Manchester M60 0AL Telephone 0161-832-8686 Internet http://www.cis.co.uk E-mail
cis@c...
CIS Deposit and Instant Access Savings Accounts are held with The Co-operative Bank p.l.c., registered in England and Wales number
990937, P.O. Box 101, 1 Balloon Street, Manchester M60 4EP, and administered by CIS Policyholder Services Limited as agent of the
Bank.
CIS is a member of the General Insurance Standards Council
CIS & the CIS logo (R) Co-operative Insurance Society Limited
********************************************************************************
Message #4 by "Steve Klein" <Stephen@K...> on Fri, 13 Dec 2002 12:44:43 -0000
|
|
For my reports I do the following
In order to hold the date I have a pretty parameter form called
frmEnterasatDate. The OK button sets a date constant
as follows:
Private Sub New_Exit_Button_Click()
On Error GoTo New_Exit_Button_Err
If IsNull(AsAtDateUnboundChoice) Then
MsgBox "You must enter a specific date"
DoCmd.GoToControl "AsAtDateUnboundChoice"
End If
RequiredAsAtDate = Me![AsAtDateUnboundChoice]
ParameterFormExitFlag = "OK"
New_Exit_Button_Exit:
DoCmd.Close A_FORM, "frmEnterAsAtDate"
Exit Sub
New_Exit_Button_Err:
MsgBox Error$
ParameterFormExitFlag = "ERROR"
Resume New_Exit_Button_Exit
End Sub
In my global variables module
Global RequiredAsAtDate As Date
I also have a small function
Function getAsAtDate() As Date
getAsAtDate = RequiredAsAtDate
End Function
Now the query includes the parameter
Between DateAdd("d",-10, getasatdate()) And getasatdate()
If you want the prepared forms I can send you them direct
Steve K
If you don't want any of the forms you van work from the parameter above
-----Original Message-----
From: Andrew Payne [mailto:andrew@p...]
Sent: 13 December 2002 12:08
To: Access
Subject: [access] Query criteria expression
I have a query that I want to filter by date. The table I'm taking the
data from has a DateEntered field, in the query I want only those rows
where the DateEntered >= current date - 10 days. I have tried entering
various expressions into the relevant criteria box for the query but have
so far not found the right one, could someone please tell me the correct
expression for this.
Thanks Andrew
|
|
 |