A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how can I concatenate fields that contain numbers?



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2010, 05:38 PM posted to microsoft.public.access.queries
Lorina
external usenet poster
 
Posts: 28
Default how can I concatenate fields that contain numbers?

I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!
  #2  
Old February 19th, 2010, 06:07 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default how can I concatenate fields that contain numbers?

ConcatTextField: [Field1] & [Field2] & [Field3] & [Field4]

--
Build a little, test a little.


"Lorina" wrote:

I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!

  #3  
Old February 19th, 2010, 06:40 PM posted to microsoft.public.access.queries
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default how can I concatenate fields that contain numbers?

You can concatenate numeric values in fact, but if the result needs to be of
a specific format, you'd need to cater for that. Say for instance the
concatenated value is made up of three separate numbers which have to be of 3
digits each, with leading zeros where necessary, e.g. 5, 10 and 15 would
become 005010015:

Format([Number1],"000") & Format([Number2],"000") & Format([Number3],"000")

But a second thought occurs to me. If a number does not equal the number in
the ERP system how will you link them to determine the incorrect ones?

Ken Sheridan
Stafford, England

Lorina wrote:
I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

  #4  
Old February 19th, 2010, 06:43 PM posted to microsoft.public.access.queries
Lorina
external usenet poster
 
Posts: 28
Default how can I concatenate fields that contain numbers?

karl
That worked like a charm! So, just so I understand the magic, does putting
ConcatTextField make it treat it as text?

"KARL DEWEY" wrote:

ConcatTextField: [Field1] & [Field2] & [Field3] & [Field4]

--
Build a little, test a little.


"Lorina" wrote:

I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!

  #5  
Old February 19th, 2010, 06:46 PM posted to microsoft.public.access.queries
Bob Barrows
external usenet poster
 
Posts: 475
Default how can I concatenate fields that contain numbers?

No, that's just the name of the resulting field.
It's the concatenation operators (&) that do the magic. & coerces both
operands to strings before concatenating them, unlike the + operator,
which really should not be used for concatenation.

Lorina wrote:
karl
That worked like a charm! So, just so I understand the magic, does
putting ConcatTextField make it treat it as text?

"KARL DEWEY" wrote:

ConcatTextField: [Field1] & [Field2] & [Field3] & [Field4]

--
Build a little, test a little.


"Lorina" wrote:

I need to take a series of numbers that are in different fields
and combine them into one number. I am linking to a spreadsheet
that contains our UPC codes. I realize that they need to be text
to concanentate, correct? I can't change the original spreadsheet
(it's a UPC number generator and the fields have to be numbers to
create the correct code for new part numbers). Once I have them in
one field in access I am going to link the to the field for UPC #
in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!


--
HTH,
Bob Barrows


  #6  
Old February 19th, 2010, 07:29 PM posted to microsoft.public.access.queries
Lorina
external usenet poster
 
Posts: 28
Default how can I concatenate fields that contain numbers?

Both the ERP system and the spreadsheet contain the part number. That will
be my common field. I will pull the UPC for each data source and then
subrtact them. Total should be 0 if it's entered correctly in the ERP system.

"KenSheridan via AccessMonster.com" wrote:

You can concatenate numeric values in fact, but if the result needs to be of
a specific format, you'd need to cater for that. Say for instance the
concatenated value is made up of three separate numbers which have to be of 3
digits each, with leading zeros where necessary, e.g. 5, 10 and 15 would
become 005010015:

Format([Number1],"000") & Format([Number2],"000") & Format([Number3],"000")

But a second thought occurs to me. If a number does not equal the number in
the ERP system how will you link them to determine the incorrect ones?

Ken Sheridan
Stafford, England

Lorina wrote:
I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

.

  #7  
Old February 19th, 2010, 07:36 PM posted to microsoft.public.access.queries
Lorina
external usenet poster
 
Posts: 28
Default how can I concatenate fields that contain numbers?

Bob -
Well....I see I have a problem! I just tried to do my math and it isn't
working. The field in the ERP is text and I am assuming my concatenated
field is also. Is there any way you know of to compare them ? A way to be
able to subtract them?

"Lorina" wrote:

Both the ERP system and the spreadsheet contain the part number. That will
be my common field. I will pull the UPC for each data source and then
subrtact them. Total should be 0 if it's entered correctly in the ERP system.

"KenSheridan via AccessMonster.com" wrote:

You can concatenate numeric values in fact, but if the result needs to be of
a specific format, you'd need to cater for that. Say for instance the
concatenated value is made up of three separate numbers which have to be of 3
digits each, with leading zeros where necessary, e.g. 5, 10 and 15 would
become 005010015:

Format([Number1],"000") & Format([Number2],"000") & Format([Number3],"000")

But a second thought occurs to me. If a number does not equal the number in
the ERP system how will you link them to determine the incorrect ones?

Ken Sheridan
Stafford, England

Lorina wrote:
I need to take a series of numbers that are in different fields and combine
them into one number. I am linking to a spreadsheet that contains our UPC
codes. I realize that they need to be text to concanentate, correct? I
can't change the original spreadsheet (it's a UPC number generator and the
fields have to be numbers to create the correct code for new part numbers).
Once I have them in one field in access I am going to link the to the field
for UPC # in our ERP system, subtract them and if the nubmer is zero I know
someone keyed it incorrectly in our ERP system

any suggestions would be GREATLY appreciated!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

.

  #8  
Old February 19th, 2010, 09:05 PM posted to microsoft.public.access.queries
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default how can I concatenate fields that contain numbers?

You can apply the Val function to each to return a number:

Val(ERPNumber]])-Val([SpreadsheetNumber])

That should do the trick.

Ken Sheridan
Stafford, England

Lorina wrote:
Bob -
Well....I see I have a problem! I just tried to do my math and it isn't
working. The field in the ERP is text and I am assuming my concatenated
field is also. Is there any way you know of to compare them ? A way to be
able to subtract them?

Both the ERP system and the spreadsheet contain the part number. That will
be my common field. I will pull the UPC for each data source and then

[quoted text clipped - 24 lines]

any suggestions would be GREATLY appreciated!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201002/1

  #9  
Old February 20th, 2010, 12:49 AM posted to microsoft.public.access.queries
David W. Fenton
external usenet poster
 
Posts: 3,373
Default how can I concatenate fields that contain numbers?

"Bob Barrows" wrote in
:

It's the concatenation operators (&) that do the magic. & coerces
both operands to strings before concatenating them, unlike the +
operator, which really should not be used for concatenation.


The + operator is INCREDIBLY USEFUL for concatenation of non-numeric
data because it propagates Nulls. This, for instance, would have to
be substantially more complex to work were it not for Null
propagation with the + operator:

FullName: Mid(("12"+LastName) & (", "+FirstName), 3)

The alternative to that requires nested IIf().

There is no non-convoluted way that I can see to propagate Nulls if
you are intending to concatenate numeric values. Since CStr() can't
accept a Null, you're out of luck using Null propagation tricks with
numeric data without additional complication (such as reliance on
something like the ZLSToNull function I posted earlier today).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
  #10  
Old February 20th, 2010, 12:57 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default how can I concatenate fields that contain numbers?

On Fri, 19 Feb 2010 11:36:01 -0800, Lorina
wrote:

Well....I see I have a problem! I just tried to do my math and it isn't
working. The field in the ERP is text and I am assuming my concatenated
field is also. Is there any way you know of to compare them ? A way to be
able to subtract them?


Please post an example of the data. What does it mean to subtract a UPC code?
That's sort of like subtracting Social Security numbers or phone numbers,
isn't it???
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.