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

In what sequence do the operators work?

Dear Contributors,

I am new to VBA and SQL and I rquest your help.

Please explain me how the operators work?
In what sequence?
How to put perantheses for the opearation sequence being "OR" first and "AND" next?

here is the code:

einSqlStmt = einSqlStmt1 & _
" IN ( " & vorfilterString & ", NOT " & vorfilterString1 & " AND NOT " & vorfilterString2 & " ) "




Thanks in advance for any help.

Regards,
Jaswanth
Jan 24 '11 #1
3 1150
pod
298 100+
that is a loaded question ...

but here goes a few basic rules:


AND: all [statement]s must be true
Ex1: TRUE = [TRUE] AND [TRUE]
Ex2: FALSE= [TRUE] AND [FALSE]

OR: at least one [statement] must be true
Ex3: TRUE = [TRUE] OR [TRUE] OR [TRUE]
Ex4: TRUE = [FALSE] OR [TRUE] OR [FALSE]

What is in a parenthesis is processed first and separately
Ex5: TRUE = [TRUE] OR ( [TRUE] AND [FALSE] )
Ex6: FALSE= ( [TRUE] OR [TRUE] ) AND [FALSE]


If you have inner level parenthesis, the deepest ones have precedence :
Ex7: TRUE = [FALSE] OR ( [TRUE] AND ( [TRUE] OR [FALSE] ) )


hope that helps ...
Jan 24 '11 #2
mshmyob
904 Expert 512MB
Your SQL string has been built wrong.

The & symbols is just conconcates your string.

einSqlStmt = einSqlStmt1 & " IN ('" & vorfilterString & "', NOT '" & vorfilterString1 & "' AND NOT '" & vorfilterString2 & "');"

Notice the single quote as in '" or "'

I didn't look at your Logical operators to see if they are correct just your sysntax of the SQL statement.

cheers,
Jan 24 '11 #3
Oralloy
988 Expert 512MB
Jaswanth,

What are you trying to accomplish?

Are you trying to build a complex boolean statement, or a series of options in an SQL IN expression? Or, perhaps a combination of both?

Nevertheless, if you are unsure of operator precedence, then use parentheses. Do not even waste time looking it up, as if you do not know it, then the next programmer after you will probably not understand what you wrote, anyway.

Also, if you use parentheses, then there is no ambiguity in the expression at all - simpy put, using parentheses removes the chance of an inadvertent mistake - the code will mean exactly what you want it to.

That said, if you can clarify exactly what you are trying to accomplish, maybe we can help you out with more than vague statements.

Luck!
Oralloy
Jan 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bangalore | last post by:
Hi, Can anybody explain , why some operators(::, ., .*, sizeof,?:) cannot be overloaded in C++? Thanks
7
by: Riku Jarvinen | last post by:
Hello everyone, I have a logging class which writes program outputs to the logfile. The class works fine as long as only C++ native data types are considered. The problem is that I have a...
1
by: Thats Me | last post by:
TMALSS: Task With maintenance of Access Database I did not develop, don't ask about non-commented code problems or where data dictionary is (LOL). Have table with Inventory data for all...
3
by: sugaray | last post by:
Can somebody explain to me what is sequence point ? With few examples would be even better. Thanx for your help.
6
by: Larry Serflaten | last post by:
I am trying to add 2 points together, and I am not succeeding. It appears the docs say I need a point and a size, but even that fails in the copy of VS 2003 I have. Exactly what are they trying...
2
by: Shea Martin | last post by:
I am moving my database from a machine running 7.4 to a machine running 7.2. My sequences are not out of wack, is there a way to set the current value of a sequence? I though ALTER SEQUENCE would...
14
by: pai | last post by:
hi.. I have a simple doubt about increment operators.. Can any one tell me what is really happening.. Eg: int i=0,ans; ( ans = ++i ++i // This
4
by: jpierson | last post by:
Hi, I'm trying to simulate a break sequence to a serial device ctrl + pause/break I tried it with limited succcess using this SendKeys.SendWait("^{BREAK}") I'm putting this code under a...
28
by: dspfun | last post by:
I'm trying to get a good understanding of how unary operators work and have some questions about the following test snippets. int *p; ~!&*++p--; It doesn't compile, why? The problem seems to be...
14
by: AliceB.Toklas | last post by:
In my Absolute Beginner's Guide to C book by Greg Perry where it is instruction how relational operators work it gives the following example: int i = 5; so the following statement is true: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.