Lookup Value & Concatenating

G

Guest

I have a Text field name Company ID in Table 1, where you
can enter values as 20,30,201, - each value separated by
commas represent Company A., Company B., Company C. I
want to lookup those value in another table (Table 2) and
have them concatenate as Company A. Company B. Company C.
under another Text Field in Table 1.

Table 1 Table 2
Company ID Company ID Company Name
20,30,201, 20 Company A.
30 Company B.
201 Company C.
Under Table 1
you would have another Text Field, named Company Names,
where those lookup values for Company ID would be
concatenated as: Company A. Company B. Company C.

Any suggestions or solutions to this complicated scenerio
would be greatly appreciated.

Thank-you,
Hans
 
R

Rebecca Riordan

Hans,

Don't do it this way. You should have separate records for each of the
companies in Table 1. If you do that, most of your complications will go
away.

HTH

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 
T

Tim Ferguson

Any suggestions or solutions to this complicated scenerio
would be greatly appreciated.

Try correcting the schema design. Check out first and second normal forms.

B Wishes


Tim F
 
E

Eric Butts [MSFT]

Hi Hans,

If I understand your scenario correctly you have in Table1 the following
records:

CompanyID CompanyName
-------------- ------------------
20,30,201
15,25,35
45,50,65

Would like the result of:

CompanyID CompanyName
-------------- ------------------
20,30,201 CompanyA, CompanyB, CompanyE
15,25,35 CompanyG, CompanyM, CompanyT
45,50,65 CompanyW, CompanyX, CompanyS

To start with you are going to need to parse out the CompanyID. Take a
look at Method 2 of the following article for some ideas. You need NOT
place the results in Multiple Fields.

ACC: How to Parse Comma-Separated Text into Multiple Fields
http://support.microsoft.com/?id=95608

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights






--------------------
| Content-Class: urn:content-classes:message
| From: <[email protected]>
| Sender: <[email protected]>
| Subject: Lookup Value & Concatenating
| Date: Tue, 6 Apr 2004 09:44:02 -0700
| Lines: 22
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQb9l4gaWt3JsTrSomSJcackOlv8g==
| Newsgroups: microsoft.public.access.tablesdbdesign
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.tablesdbdesign:78063
| NNTP-Posting-Host: tk2msftngxa09.phx.gbl 10.40.1.161
| X-Tomcat-NG: microsoft.public.access.tablesdbdesign
|
| I have a Text field name Company ID in Table 1, where you
| can enter values as 20,30,201, - each value separated by
| commas represent Company A., Company B., Company C. I
| want to lookup those value in another table (Table 2) and
| have them concatenate as Company A. Company B. Company C.
| under another Text Field in Table 1.
|
| Table 1 Table 2
| Company ID Company ID Company Name
| 20,30,201, 20 Company A.
| 30 Company B.
| 201 Company C.
| Under Table 1
| you would have another Text Field, named Company Names,
| where those lookup values for Company ID would be
| concatenated as: Company A. Company B. Company C.
|
| Any suggestions or solutions to this complicated scenerio
| would be greatly appreciated.
|
| Thank-you,
| Hans
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top