Results 1 to 6 of 6
  1. #1
    snewton is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    7

    Concatenate - but do it even if there is no value?

    Hi all,



    I'm trying to concatenate 4 values. So, for instance, I have:

    PartNumberLong: [BuildingName]&"."&[DivisionName]&"."&[PartName]&"."&[FinishName]

    The query returns records just fine. However, in some cases, I have not yet defined the [FinishName] for that particular part. In which case, the query returns no results. I do get results if I leave [PartName] blank though.

    Is there something I can stick into the criteria to return all parts regardless of the blank fields? Not sure where to go with this.

    Thanks,
    Stephen

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Could try wildcard.

    Why are you filtering on concatenated value?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    snewton is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    7
    Quote Originally Posted by June7 View Post
    Could try wildcard.

    Why are you filtering on concatenated value?
    I'm not sure what you mean by filtering? I am trying to create a composite part number based on four separate tables.

    Database structure is like so https://www.accessforums.net/attachm...9&d=1331323901

    Thanks,
    Stephen

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You are concatenating fields and then applying a filter criteria to that compound value - right?

    I don't understand why you are constructing a part number from those 4 values. That is one heck of a long identifier. Why do you need this? The data structure in that ERD is probably using Autonumber fields as primary keys.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    snewton is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    7
    Quote Originally Posted by June7 View Post
    You are concatenating fields and then applying a filter criteria to that compound value - right?

    I don't understand why you are constructing a part number from those 4 values. That is one heck of a long identifier. Why do you need this? The data structure in that ERD is probably using Autonumber fields as primary keys.
    June,

    Thank you for your reply. I am not filtering the result. I just want to add the fields together, regardless of their contents (blank or not)

    To answer your other question - We've decided that each element we produce for a VERY large job (think 20 million dollars), must have a unique identifier. But, if we are going to uniquely identify each part, why wouldn't we make it a smart number? So the elements 252.TR.001.195 and 296.TR.001.189 will be the same fabrication method and dimensions, but different paint, and different building.

    In case it is important, I have since updated the relationships according to this discussion https://www.accessforums.net/showthr...atabase-Design and the updated relationships look like this now https://www.accessforums.net/attachm...7&d=1331664284

    Thanks,
    Stephen

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What had me confused was the statement in your first post that 'the query returns no results' so I thought filtering was issue. However, it is quite possible because of the jointype in the query. Show query statement for analysis.

    The use of 'smart' identifiers has its arguments on both sides. One is the very issue you encountered - one of the pieces of the compound ID doesn't exist. If all components will always be (eventually) available, then possibly this will serve your requirements.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Using a query to concatenate data
    By ocampod in forum Queries
    Replies: 15
    Last Post: 03-20-2012, 08:11 AM
  2. Concatenate 2 columns in one
    By playas in forum Queries
    Replies: 2
    Last Post: 02-20-2012, 12:05 PM
  3. Concatenate FROM Clause
    By Tyork in forum Queries
    Replies: 1
    Last Post: 05-20-2011, 02:12 PM
  4. concatenate
    By stephenaa5 in forum Programming
    Replies: 2
    Last Post: 10-11-2010, 05:18 PM
  5. Concatenate Formula
    By Shingo in forum Programming
    Replies: 1
    Last Post: 07-25-2009, 09:14 AM

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