Year Only as Query Parameter

K

Kathy Webster

I have an [InvoiceDate] field in a query. I want the user to be prompted to
enter the desired year they want matching records for. For example, if they
enter 2004, the query will return all records where the [InvoiceDate] is
between 1/1/2004 and 12/31/2004. How do I set this up as a parameter query?

Thank you,
Kathy
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PARAMETERS [Invoice Year?] Integer;
SELECT ...
FROM ...
WHERE InvoiceDate BETWEEN DateSerial([Invoice Year?],1,1)
AND DateSerial([Invoice Year?],12,31)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9gm34echKqOuFEgEQJeCwCgp8TW35pl8v/O9W9CUWcpNKCaDSgAoO8b
eelQ9imFvRYM+H1/OWCTnFgB
=Akl8
-----END PGP SIGNATURE-----
 
F

fredg

I have an [InvoiceDate] field in a query. I want the user to be prompted to
enter the desired year they want matching records for. For example, if they
enter 2004, the query will return all records where the [InvoiceDate] is
between 1/1/2004 and 12/31/2004. How do I set this up as a parameter query?

Thank you,
Kathy

Where Year([InvoiceDate]) = [Enter the year]
 
K

Kathy Webster

Thank you Fred! It is perfect!

fredg said:
I have an [InvoiceDate] field in a query. I want the user to be prompted
to
enter the desired year they want matching records for. For example, if
they
enter 2004, the query will return all records where the [InvoiceDate] is
between 1/1/2004 and 12/31/2004. How do I set this up as a parameter
query?

Thank you,
Kathy

Where Year([InvoiceDate]) = [Enter the year]
 
K

Kathy Webster

Perfect! Thanks so much!

fredg said:
I have an [InvoiceDate] field in a query. I want the user to be prompted
to
enter the desired year they want matching records for. For example, if
they
enter 2004, the query will return all records where the [InvoiceDate] is
between 1/1/2004 and 12/31/2004. How do I set this up as a parameter
query?

Thank you,
Kathy

Where Year([InvoiceDate]) = [Enter the year]
 
Top