473,320 Members | 2,020 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,320 software developers and data experts.

The expression you have entered is too complex

I am trying to get around the problem "The expression you have entered
is too complex" for a select query. (The example below is not the
expression that is giving me headaches.)

So I am thinking that I just need to do the parsing and calculating in
an event procedure for an "On Click" event.

My question is:

If I have a query field in access97 that parses date (in format
"MM/DD/YYYY") of a field [DOB] in a table like:

BIRTHDAYNUM:Val(Left((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),InStr((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),"/")-1))

(I know that I could do this some other way inside the query to get
the day but I want to learn how you would communicate between an event
procedure and a query [GET_BIRTHDAYNUM_Q] called inside the event
procedure: Private Sub GET_BIRTHDAYNUM_Click().)

What would the code need to be so that I am able to pull the data from
the field [DOB] in each record in a table [Employee], manipulate it,
and then put the result into the field [BIRTHDAYNUM]?
Nov 12 '05 #1
2 6039
sa****@uni.edu (Mikel) wrote in message news:<7c**************************@posting.google. com>...
I am trying to get around the problem "The expression you have entered
is too complex" for a select query. (The example below is not the
expression that is giving me headaches.)
Not sure why you haven't posted the actual problem, but maybe my
solution to the problem you DID post will help you with the solution
you seek.

The "too complex" error is usually related to too many nested IFs,
which I don't see below. As a matter of fact, in your example below,
you should not be getting the error message at all. It should work.
My question is:

If I have a query field in access97 that parses date (in format
"MM/DD/YYYY") of a field [DOB] in a table like:

BIRTHDAYNUM:Val(Left((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),InStr((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),"/")-1))

My solution, for your query value, use this instead:
BIRTHDAYNUM: Format([DOB],"dd")
(I know that I could do this some other way inside the query to get
the day but I want to learn how you would communicate between an event
procedure and a query [GET_BIRTHDAYNUM_Q] called inside the event
procedure: Private Sub GET_BIRTHDAYNUM_Click().)

What would the code need to be so that I am able to pull the data from
the field [DOB] in each record in a table [Employee], manipulate it,
and then put the result into the field [BIRTHDAYNUM]?


My guess would be to put the following code in your On Click event:

[BIRTHDAYNUM]=Format([DOB],"dd")

Dennis
Nov 12 '05 #2
sa****@uni.edu (Mikel) wrote in message news:<7c**************************@posting.google. com>...
I am trying to get around the problem "The expression you have entered
is too complex" for a select query. (The example below is not the
expression that is giving me headaches.)

So I am thinking that I just need to do the parsing and calculating in
an event procedure for an "On Click" event.

My question is:

If I have a query field in access97 that parses date (in format
"MM/DD/YYYY") of a field [DOB] in a table like:

BIRTHDAYNUM:Val(Left((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),InStr((Mid([DOB],(InStr([DOB],"/"))+1,(InStr((InStr([DOB],"/")+1),[DOB],"/")))),"/")-1))

(I know that I could do this some other way inside the query to get
the day but I want to learn how you would communicate between an event
procedure and a query [GET_BIRTHDAYNUM_Q] called inside the event
procedure: Private Sub GET_BIRTHDAYNUM_Click().)

What would the code need to be so that I am able to pull the data from
the field [DOB] in each record in a table [Employee], manipulate it,
and then put the result into the field [BIRTHDAYNUM]?


you could use the standard VBA-functions cdate or datevalue (also
accepts monthnames) or - if the system-defaults, calendar-property of
the project don't comply with the notation to convert you also can
write a public VBA function in a module to use within your
SQL-expression. When using Jet/DAO this will work. I don't have
experience in the ADO-environment.
It is also possible that some other problem in your SQL-expression is
the cause of the error-message.

Marc
Nov 12 '05 #3

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

Similar topics

0
by: belzibob | last post by:
I have an Access 2000 MDE that I can deploy via Wise 9.0 for Windows script successfully to 95/98, NT, 2000, XP, Xp/pro, and Me. This works fine in all environments on any number of pc's so I am...
3
by: CLarkou | last post by:
On a client's machine with Office 97, my access program gives an error "The Expression you entered refers to an object that is closed or doesn't exist" when I am assigning a value in the checkbox....
3
Fotorat
by: Fotorat | last post by:
I did this code converts a date into a value -1 to -12 to be used in crosstab report headers. The problems arises when I insert the last IIF statement for month -12!!! up to -11 it runs and...
1
by: sumit205 | last post by:
Error 2467:The Expression you entered refers to an object that is closed or doesn't exist . DoCmd.OpenForm frm2, WindowMode:=acDialog, OpenArgs:="c" & NewProductID In the debig mode when i...
6
by: weston | last post by:
In Access 2000 I have a form with a tab control with 3 tabs. I have a button that is supposed to check if each question on the form has been completed. The code that is under this button is below. It...
5
by: curtok | last post by:
I am having trouble trying to get and expression to work. I keep getting the same syntax error, you may have entered and operand without an operator. What i am trying to do: one field contains a...
2
by: shalskedar | last post by:
I 've created Report in Ms access which contains subform.The field value in the report is retrieved from the subform.When this report is exported,it shows the error as The expression you entered has...
2
by: Steven Hayes | last post by:
Thanks for any help I'm new at this. I have the following excel statement: =IF(B131="", "Input UFMIP", IF((B131-B133)<0, 0, IF(B131>0, B131-B133, 0))) I tried unsuccessfully to convert to...
1
by: Steven Hayes | last post by:
I am trying to convert this excel expression into an Access expression: =IF(OR(B79="",B62="", H7=""),"Required Fields Incomplete",IF(AND(F87<20000,OR(J87>P14, B87>P37)),"Yes, this is a HIGH COST...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.