473,324 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

FORMS!reference too complex to run SQL query error

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)

Nov 13 '05 #1
2 1624
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-----
Nov 13 '05 #2
THank you,

I don't know how I forgot the orderby.

I added the order by clause and I was good.

THANK YOU. so sorry for my stupidity.

Also thank you for the parameter and serial function, I did not know
you could do that.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: KK | last post by:
Windows Forms Inheritance, Incomplete? I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can be used effectively if the...
2
by: KK | last post by:
** Posting it here cause after couple of days no body responded.** I was playing around with Windows Forms and found out this Forms Inheritance feature. The moment I saw that, I felt this can...
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
9
by: Bob Alston | last post by:
I am looking for electronic forms software that would integrate well with MS Access. I have a client for whom I built a client database to replace and update one they had that was obsolete and...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.