st*****@hotmail.com wrote:
I have the following query
SELECT TOP 1 CDate(forms!frm_a!cbo_period & '/1/' &
forms!frm_a!cbo_year) AS mydate, *
FROM DBO_table
WHERE DBO_table.field1=forms!frm_a!cbo_field1 And
DBO_table.field2=forms!frm_a!cbo_field2;
I get the following error...
"This expression is typed incorrectly, or it is too complex to be
evaluated. For example, a numeric expression may contain too many
complicated elements. Try simplifying the expression by assigning
parts of the expression to variables."
I've tried many different way to run this query with no luck. I've
looked in the interent and can not find any thing. PLEASE HELP!
FYI:
PERIOD is a value 1-12
YEAR is the year (2005, 2006, etc)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You're using a TOP 1 without an ORDER BY clause, which doesn't make any
sense. Do you want the first/last date? What do you want to be on TOP?
Other stuff
===========
You may wish to try DateSerial(year, month, day)
DateSerial(forms!frm_a!cbo_year, forms!frm_a!cbo_period, 1)
Ensure the combo boxes are returning numerals, not text values - use the
PARAMETERS clause on the query:
PARAMETERS forms!frm_a!cbo_period Byte, forms!frm_a!cbo_year Integer;
SELECT TOP 1 *,
DateSerial(forms!frm_a!cbo_year, forms!frm_a!cbo_period, 1) AS mydate
FROM DBO_table
WHERE DBO_table.field1=forms!frm_a!cbo_field1 And
DBO_table.field2=forms!frm_a!cbo_field2
ORDER BY ???? DESC [or ASC]
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQwOcsIechKqOuFEgEQK6egCgx0gs+EBXcrFaF8ZUgNyKiR hGzIAAoMCH
TUXIFaefTbM9XPSMJHq7HhTt
=3COv
-----END PGP SIGNATURE-----