Concatenate in Access~special circumstances

matchmole

New Member
Joined
Jun 18, 2002
Messages
26
Hi,
I need to be able to combine (concatenate?) fields in Access so that each item in Field 1 is joined to each item in Fields 2 thru 5. I have tried to illustrate this in the samples below...

In the samples below, Account code is in Field 1... String(s) to be added are in Field 2. Then in Field 3 I need for each code in Field 1 to be joined with all of the strings in Field 2 thru Field 5.

Account Code String(s) to be added to each Account Code
001-001001-001234- 401260
001-001001-002345- 401270
001-001001-003456- 401280
001-001001-004567- 750400
001-001001-005678- 410000
001-001001-006789- 420000
002-002001-001234- 430000
002-002001-002345- 440000
002-002001-003456- 450000
002-002001-004567- 460000
002-002001-005678-
002-002001-006789-
002-002001-006543-
002-002001-006432-
002-002001-006321-

So I would like to end up with this result:
001-001001-001234-401260
001-001001-001234-401270
001-001001-001234-401280
001-001001-001234-750400
001-001001-001234-410000 ... and on and on until each account code in Field 1 has been combined with every string in Field 2 thru Field 5. Is that possible to accomplish using Access?

Thanks,
Ken
 

Some videos you may like

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Add the table to a new query, 5 times.
Double-click Field1 from the first table
Double-click Field2 from the second table
...etc until Field5 is in the grid.
Don't join any of the tables.

When you run the query you should get all possible combinations of the 5 fields.

Denis
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,655
Messages
5,512,645
Members
408,908
Latest member
ShaneMorr

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top