473,385 Members | 1,873 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.

Join two strings together

Dear everyone,

I would like to join a prefix and a number which are separated by a "-" and do not know why it could not work for me. Can you please tell me why this code doesn't work:

=IIf([Prefix] Is Null,"",Trim$([prefix])) & “-“ & Right$(Str$([Voucher No]+10000),4) & IIf([Suffix] Is Null,"",Trim$([Suffix]))

It is in a report and always as me to Enter Parameter "

Otherwise the following works but without a "-"

=IIf([Prefix] Is Null,"",Trim$([prefix])) & Right$(Str$([Voucher No]+10000),4) & IIf([Suffix] Is Null,"",Trim$([Suffix]))

Cheers.
Sep 7 '07 #1
1 2065
FishVal
2,653 Expert 2GB
Dear everyone,

I would like to join a prefix and a number which are separated by a "-" and do not know why it could not work for me. Can you please tell me why this code doesn't work:

=IIf([Prefix] Is Null,"",Trim$([prefix])) & “-“ & Right$(Str$([Voucher No]+10000),4) & IIf([Suffix] Is Null,"",Trim$([Suffix]))

It is in a report and always as me to Enter Parameter "

Otherwise the following works but without a "-"

=IIf([Prefix] Is Null,"",Trim$([prefix])) & Right$(Str$([Voucher No]+10000),4) & IIf([Suffix] Is Null,"",Trim$([Suffix]))

Cheers.
Hi, there.

Just a thought. Try to use IsNull() function instead of object comparisson operator "Is".
And BTW the expression could be simplified.

1. Concatenation operator "&" unlike math and logic operators doesn't work according to tristate logic.
e.g.
? "qwerty" + Null
Null
? "qwerty" & Null
qwerty

So check for Null value is not needed.

2. Expression
Expand|Select|Wrap|Line Numbers
  1. Right$(Str$([Voucher No]+10000),4)
  2.  
will return always the same as
Expand|Select|Wrap|Line Numbers
  1. Right$(Str$([Voucher No]),4)
  2.  
And, not concerning the problem, get reed of all this "$". This exists for backward compatability only and is supposed to be ceased in future.
Sep 7 '07 #2

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

Similar topics

16
by: Jim Hefferon | last post by:
Hello, I'm getting an error join-ing strings and wonder if someone can explain why the function is behaving this way? If I .join in a string that contains a high character then I get an ascii...
46
by: Leo Breebaart | last post by:
I've tried Googling for this, but practically all discussions on str.join() focus on the yuck-ugly-shouldn't-it-be-a-list-method? issue, which is not my problem/question at all. What I can't...
7
by: stabbert | last post by:
I am attempting to join two tables together on two different unix servers. Here is some relevant info about the tables. TABLE 1 Setup ----------------------- DB2 UDB 7.2 EE
11
by: Michael \(michka\) Kaplan [MS] | last post by:
A little light humor... this "easter egg" was hidden deep in the Access 95 help system. I did not write it (I am not this creative and never was) and I did not put it in the product (I was not on...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
9
by: Steven | last post by:
Hello, I have a question about strcmp(). I have four words, who need to be compared if it were two strings. I tried adding the comparison values like '(strcmp(w1, w2) + strcmp(w3, w4))', where...
3
by: Sandra-24 | last post by:
I'd love to know why calling ''.join() on a list of encoded strings automatically results in converting to the default encoding. First of all, it's undocumented, so If I didn't have non-ascii...
27
by: Paulo da Silva | last post by:
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way:
6
by: Matt Mackal | last post by:
I have an application that occassionally is called upon to process strings that are a substantial portion of the size of memory. For various reasons, the resultant strings must fit completely in...
54
by: bearophileHUGS | last post by:
Empty Python lists don't know the type of the items it will contain, so this sounds strange: 0 Because that may be an empty sequence of someobject: 0 In a statically typed language in...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.