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

Concatenate number and text

All,

I have the following expression in a query:

Switch([Code 5 Digits]>=10121 And [Code 5 Digits]<=10135,[Code 5
Digits]&"xxx")

(There are other expresions within Switch, but this is the one in
question.)

I need to evaluate [Code 5 Digits] as a number, but then concatenate
with the text "xxx" if it meets the conditions.

Thanks.

JG Scott

Dec 31 '06 #1
3 5985

What happens when [Code 5 Digits] is null or is not between or equal
the limits?

In a Access sql query I would try IIF() which has true AND false
parameters.

IIf(expr, truepart, falsepart)

IIf([Code 5 Digits]>=10121 And [Code 5 Digits]<=10135, [Code 5 Digits]
& "xxx", "failed")

Nancy

On 31 Dec 2006 12:16:44 -0800, "jg******@bellsouth.net"
<jg******@bellsouth.netwrote:
>All,

I have the following expression in a query:

Switch([Code 5 Digits]>=10121 And [Code 5 Digits]<=10135,[Code 5
Digits]&"xxx")

(There are other expresions within Switch, but this is the one in
question.)

I need to evaluate [Code 5 Digits] as a number, but then concatenate
with the text "xxx" if it meets the conditions.

Thanks.

JG Scott
Dec 31 '06 #2
Hi, JG.
I need to evaluate [Code 5 Digits] as a number, but then concatenate
with the text "xxx" if it meets the conditions.
Use the Val( ) function to evaluate a string as a number. Try (watch out for
word wrap):

Switch(Val([Code 5 Digits]) >=10121 And Val([Code 5 Digits]) <=10135, [Code 5
Digits] & "xxx")

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
<jg******@bellsouth.netwrote in message
news:11**********************@s34g2000cwa.googlegr oups.com...
All,

I have the following expression in a query:

Switch([Code 5 Digits]>=10121 And [Code 5 Digits]<=10135,[Code 5
Digits]&"xxx")

(There are other expresions within Switch, but this is the one in
question.)

I need to evaluate [Code 5 Digits] as a number, but then concatenate
with the text "xxx" if it meets the conditions.

Thanks.

JG Scott

Dec 31 '06 #3
I agree with Gunny that you may need to ensure the [Code 5 Digits] is
evaluated as a number and you could use Val([Code 5 Digits]) or
CInt([Code 5 Digits]) to do this.

You could use Switch to look at another range of numbers by adding
more arguments. Like this:
Switch(
[Code 5 Digits]>=10121 And [Code 5 Digits]<=10135,[Code 5
Digits]&"xxx",
[Code 5 Digits]>10135,"is larger",
[Code 5 Digits]<10121,"is smaller")

Just make sure the ranges used do not overlap <grin>

Nancy

On 31 Dec 2006 12:16:44 -0800, "jg******@bellsouth.net"
<jg******@bellsouth.netwrote:
>All,

I have the following expression in a query:

Switch([Code 5 Digits]>=10121 And [Code 5 Digits]<=10135,[Code 5
Digits]&"xxx")

(There are other expresions within Switch, but this is the one in
question.)

I need to evaluate [Code 5 Digits] as a number, but then concatenate
with the text "xxx" if it meets the conditions.

Thanks.

JG Scott
Jan 2 '07 #4

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

Similar topics

1
by: Mike | last post by:
Hey guys! Is there anyway to concatenate then do a carriage return in a list box? I'm trying to piece multiple pieces of text together and put it into a list box. I'm trying to get my listbox...
30
by: priya | last post by:
Hi How to concatenate two integer Values. Example Program : #include "Port.h" #include "BinaryConversion.h" # include "iostream.h"
3
by: Bosconian | last post by:
I have form values stored in an object. I have a set of numbered form fields: specialty1 specialty2 specialty3 I need to loop through these, check for content and process accordingly. I...
5
by: gwarning! | last post by:
Goal: Have multiple text files, each of various lengths, be concatenated together into one final consolidated text file. Problem: Since the names of the files to be concatenated can change from...
3
by: Tom | last post by:
Hi I want to retrieve database data and concatenate them to a string. Here is my code .ToString()); //runtime error her } while (dr.NextResult()) string array =...
6
by: Sheldon | last post by:
Hi, I am trying to build a large array using concatenate function in python. So as I loop over the number of arrays, of which there are 12 (4 down and 3 across), I create 3 long arrays by...
4
by: Dan | last post by:
Hi all, I am creating a search table where the keywords field is made up of several text fields and this is causing me some problems. I can concatentate the text ok but i can't seem to concatenate...
6
by: drazenj | last post by:
Hi , sorry for my english ... I work in high school as a teacher and try to make CLASS SCHEDULE (TIME schedule) for my collegues and for students . My problem is that I don't know how to...
10
by: Aaron Hoffman | last post by:
Hello, I'm hoping someone might be able to offer some guidance to my problem. I have one query in MS Access which consists of 2 tables joined by a SEQUENCE_ID. By joining the two tables I am...
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: 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
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...

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.