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 number which start with either a 1, 2, 3, or 4 and I want the previous field to automatically fill in a correct item based on what the number starts with.
This is the expression that I was trying to modify - > IIF(Left[Number;1]=1,"DDA",IIF(left[Numbe;1]=2,"SAV","IIF(left[Number;1]=3,"CD",IIF(left[Number;1]=4,"LAS")))))))
Any suggestions as to what I am doing wrong. I am new to all of this.
Thank you for any feedback
5 26434 ChipR 1,287
Recognized Expert Top Contributor
I don't think it's a good practice to have a semicolon in the name of a field or control, but also Number is missing an 'r' in the second IIf. This may or may not be the result of retyping your code.
That was my first thought too, Chip! But he's using the semi-colon to separate the field name and the 1 in the function!
Where to start?
First off, unless you're using some strange Regional Settings, the comma is usually used to seperate the arguments in a function, not a semi-colon. You also have to use parentheses when using a function, so you need
Left(Number,1)
not
Left[Number;1]
In your second IIF() you've misspelled your field, leaving off the final "r."
IIF(left[Numbe;1]=2
and lastly, Number is a Reserved Word in Access and shouldn't be used as a field/control name.
There may be other errors; these serpentine nested IIF() construct are always hard to debug and really should be avoided.
Welcome to Bytes!
Linq ;0)> ChipR 1,287
Recognized Expert Top Contributor
Oh you're right, that's not supposed to be a field name. The brackets threw me off.
NeoPa 32,578
Recognized Expert Moderator MVP
On top of what's already been said you have an extraneous (extra) " before your third IIF.
Also, you don't say where this expression is supposed to go. In VBA? In SQL?
Lastly, please check this out.
It is always a good idea to ensure that variable name checking is enabled, AND your code compiles (at least compilation has been attempted), before submitting a question (Require Variable Declaration).
This avoids asking questions which are much more easily resolved on your own PC than on a forum.
To ensure variable name checking is enabled for all new modules, go to - Tools / Options / Editor (from the VBA Editor window) and set Require Variable Declaration to True (checked). For existing modules, ensure that the Option lines at the very top include : NeoPa 32,578
Recognized Expert Moderator MVP
Oh, and you seem to have 3 more closing parentheses than opening ones.
Welcome to Bytes!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Joe Seigh |
last post by:
Is there a good write on this. The textbooks I have fluff over
on this? Specifically, I trying to dereference with 2 levels
of type conversion not 1, i.e.
X<T> -> z => Y<T> -> z => T* -> z
and
*X<T> => *Y<T> => *T
The Y<T> conversion has to be done as an expression temp. It cannot be done
|
by: jayj0nes |
last post by:
I'm querying a Mas90 db via ADO in Access.
The following SQL gives me the error "Invalid Operand for Operator: ="
"SELECT * from GL_DetailPosting where PostingDate >= '#01/01/2004#'"
These other queries work just fine, and they return valid data in the
PostingDate field:
"SELECT * from GL_DetailPosting"
"SELECT * from GL_DetailPosting order by PostingDate DESC"
Any ideas where I am going wrong? I've tried just about every syntax I
|
by: sonu |
last post by:
Hi i want to find the greater number without any operator.
so please any one help me and send some code
Thanks
Sonu
|
by: Fir5tSight |
last post by:
Hi,
I am using a DataView to displaying a records from datatable. I have a
filter that I define it as follows:
"Status = '' || Status <'Scanned'"
The problems is that I get an error about "Missing operand before '|'
operator".
|
by: ek |
last post by:
In the class below I overload the "()" operator. When reading an
element in an int array "()" is therefore used. But why can't I still
use "" when writing something like a = 4;
class MyArray {
public:
MyArray(int a) : data(new int){}
~MyArray() {delete data;}
| |
by: teneesh |
last post by:
this code looks perfect to me - what am i doing wrong to get the error?
=IIf(=41,"Morning Reports",IIf(=4,"Noon Conference",IIf(=9,"Grand Rounds")))
|
by: alice123 |
last post by:
I have a DataTable with ColumnName: ++CustomerName++.
when i try to filter this DataTable as
string columnName=Table.Columns.ToString();
DataRow row = Table.Select(columnName + " = 'Alice');
I am getting the above error.
I feel that because the column name is containing '+' sign, I am getting this error. If the column name does not contain + sign then the filtering is working fine for me.
|
by: Light1 |
last post by:
Hi - I am completely new to access - this is my first project and I have a question that is probably extremely easy for most.
I am trying to take two fields of information and combine them in to one field on a report. I have the following code in the Control Source:
=&” “&
I receive the error "You may have entered an operand without an operator"
What am I missing? From everything I have looked at, it seems like it should work.
...
|
by: glitke |
last post by:
I need the quantity entered in a field to be <= a certain quantity. I've opened the field properties and entered the following under the "Validation Rule".
<= ( sum ( ( ! ) Where ( ( ! = ) AND ( ! = ) AND ( ! = "Received" Or "Shipped" Or "Scrapped" ) ) ) )
I get the error message:
"The expression you entered contains invalid syntax."
"You may have entered an operand without an operator."
Any ideas or additional info needed?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |