Results 1 to 12 of 12
  1. #1
    qcjustin is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2012
    Location
    Washington
    Posts
    18

    Concatenate Function - Having Issues with DConcat

    I am trying to use the DConcat (or any other function;there are several DConcat found at http://eileenslounge.com/viewtopic.php?p=48878#p48878) to group and concatenate the data.
    The data is in this format:

    ColumnA ColumnB
    3-4514707656 3C00005
    3-4514707656 4G3-2113
    3-4514707656 4H3-0412
    3-4514707656 6C90000R


    What I would like to see is



    ColumnA ColumnB
    3-4514707656 3C00005,4G3-2113,4H3-0412,6C90000R

    Right now i have this in my query: PartsUsed: DConcat("ColumnB","Table1",[LowEndTable].[SR #]=[Table1].[ColumnA])

    Even with a join and the operator [LowEndTable].[SR #]=[Table1].[ColumnA],

    The output is putting ALL part #s in one field, regardless of the order#.
    What am i missing?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't think you got the third argument correct. Try

    PartsUsed: DConcat("ColumnB","Table1","[SR #]=" & [ColumnA])
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    qcjustin is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2012
    Location
    Washington
    Posts
    18
    This now gives me Run Time Error 3061. Too Few Parameters. Expected 1.
    I have it selecting the first field, and the second field in the query is now this:

    PartsUsed: DConcat("ColumnB","Table1","[SR #]=" & [ColumnA])

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    First guess is that something is spelled wrong.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    qcjustin is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2012
    Location
    Washington
    Posts
    18
    I dont think thats the case however. Here is a link to the test copy of the DB.
    When i make the change you mention in a new test environment, it seems to freeze.
    When i switch back, it runs quickly, but using all part numbers, not just the ones on this order (4 total)

    http://www.filedropper.com/testdb

  6. #6
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    You have a lot more issues to deal with before trying to concatenate.

    Low end table needs an auto number as the primary key. Then all of the numbers/text you add there is assigned a number which will be used as a reference in your database.

    you have numbers that don't exist in the low end table in a linked field in table 1.


    ColumnA ColumnB
    1 3C00005
    1 4G3-2113
    1 4H3-0412
    2 6C900006
    That's what it should be like in my opinion then you add the long numbers only once in the other table. (providing you set up the relationships.)

    also I would name your columns as descriptively as possible whilst keeping them short. Column A should be SR_ID and you also need that field in LowEndTable

  7. #7
    qcjustin is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2012
    Location
    Washington
    Posts
    18
    The SR# is the primary key for Low End Table.
    Its OK that i have numbers that don't exist, that was the test.
    The only SR I want results for in the test is the one in LowEndTable.
    That one SR should concatenate these 4 parts.

    ColumnA ColumnB
    3-4514707656 3C00005
    3-4514707656 4G3-2113
    3-4514707656 4H3-0412
    3-4514707656 6C90000R

    The naming of the columns should not matter, someone has to have a simple answer for this.
    If the attached sample could me remedied, i would appreciate it. I have spent hours already on this with no avail.
    No one seems to explain it in a matter that makes sense to me.
    In my mind, it seems VERY simple.
    Group by this field, and split the other field into multiple dynamic outputs separated by a comma.
    The reverse matching back to the key seems to be the only problem.
    The "key" would be SR #. The other things are part numbers.

  8. #8
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Okay but 75% the records in your column A don't exist in the Low end table. You can have long names as unique ID numbers but when you add more data and fields surely 1 is better than 11111111111 for all of your data.

    This is your choice and if you don't hold a lot of data it wont matter. Its just not good practice.

    Did you want all records in table 1 to be linked to lowendtable?

    If so you need to properly set up the relationship and ensure all your SR# are in the table.

  9. #9
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Column A is a text value so you need to quote the test condition.

    PartsUsed: DConcat("ColumnB","Table1","[SR #]='" & [ColumnA] & "'")

    See:http://www.techrepublic.com/blog/mic...s-in-vba-code/


    Jeff

  10. #10
    qcjustin is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Dec 2012
    Location
    Washington
    Posts
    18
    I made this correction, and with only 1 record to match, it freezes. Any ideas? Can someone look in the sample DB?

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You'll have better luck with people looking at the sample if you attach it to a post here (compact and then zip). Many people don't like going to other sites to download.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Homegrownandy View Post
    You have a lot more issues to deal with before trying to concatenate.
    I have to agree with Homegrownandy on this issue.

    You shouldn't use spaces, punctuation or special characters (underscore is the exception) in object names.... only letters and numbers.
    FYI, the hash sign (#) is a date delimiter in Access.


    You might check out Allen Browne's code at :
    Concatenate values from related records
    http://www.allenbrowne.com/func-concat.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Having Issues With MsgBox Function.
    By nick404 in forum Programming
    Replies: 12
    Last Post: 07-02-2015, 07:52 PM
  2. Replies: 3
    Last Post: 07-02-2015, 02:17 PM
  3. Concatenate Function for Table1
    By harpreett.singhh@gmail.co in forum Access
    Replies: 1
    Last Post: 03-17-2014, 08:04 PM
  4. Concatenate function problem
    By Matt18 in forum Programming
    Replies: 1
    Last Post: 11-19-2011, 05:37 AM
  5. Replies: 1
    Last Post: 08-18-2010, 02:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums