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

    Question Merging Data from 3 Cells to One Cell

    I'm trying to create a unique identifier for an online store, which includes a products Grade, Weight and UPC and then combined into a single cell (Grade-UPC-Weight). I've been trying to figure out how to get a query to run (properly), but have had no luck. I've figured out how to Concatenate the cells with the following expression:

    ID: [Grade] &""& [UPC] &""& [Weight]

    I'm not sure if that's what I need or not, but there's one step further.

    I have a form, which the user will be entering the Grade and Weight for an item, which will be appended into a second table. Once the data is entered, the users click a button to send the data. On the same click I'd like to run concatenate query in a macro, which I already have in place. This query would generate the data into the second table. I have no problems getting the Grade and Weight appended into the second table, I'm just having issues getting them to both work at the same time, if it's even possible?



    Any help is much appreciated.
    Last edited by Upon66; 08-11-2012 at 10:49 AM.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why? I presume the UPC is a unique value. Each UPC can have several grade and weight values? I really don't like compound keys.

    You want the compound value and the grade and weight to all be saved to a new record in second table? Why not just save the 3 values into separate fields? Either save the compound value or the individuals.

    The empty string is not needed in the concatenation. If you want a space in the result, then:

    ID: [Grade] & " " & [UPC] & " " & [Weight]
    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
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I don't think that
    D: [Grade] &""& [UPC] &""& [Weight]

    is what you need or want.
    There are no cells in Access. Access is different than Excel.

    You should read this article on database principles.
    http://forums.aspfree.com/attachment...achmentid=4712

    And review Normalization in order to set up your tables to facilitate what you are trying to do.
    see the first few topics at
    http://www.rogersaccesslibrary.com/forum/topic238.html

  4. #4
    Upon66 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    3
    Quote Originally Posted by June7 View Post
    Why? I presume the UPC is a unique value. Each UPC can have several grade and weight values? I really don't like compound keys.

    You want the compound value and the grade and weight to all be saved to a new record in second table? Why not just save the 3 values into separate fields? Either save the compound value or the individuals.

    The empty string is not needed in the concatenation. If you want a space in the result, then:

    ID: [Grade] & " " & [UPC] & " " & [Weight]
    The UPC isn't being used as a primary key. There is another source of data that is being used as the primary key, which uniquely identifies each item.

    The products are being sold on eBay, and have varying conditions. The Grade-UPC-Weight code was going to be used for a unique identifier so that when the item is sold, we are able to quickly identify/ship the product out. This code is going to be placed on the listing, so that we don't have to reference the database to process the item for shipment.

    The Grade-UPC-Weight identifier doesn't necessarily have to be generated into a new field of data in the table. The data could be concatenated into a form, just for a simple copy/paste whenever the item is being listed. Is this even possible to do in a form?

  5. #5
    Upon66 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    3
    Was just able to get the data concatenated in the form using this in the control source of a text box

    =[Grade] & "-" & [UPC] & "-" & [Weight]

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Quote Originally Posted by Upon66 View Post
    Was just able to get the data concatenated in the form using this in the control source of a text box

    =[Grade] & "-" & [UPC] & "-" & [Weight]
    Because you can do something, doesn't mean you should do it.
    A PK is an attribute of a table and is typically used by the underlying data base management system. It's for system use.
    There is absolutely no reason to have the "-" in the PK.
    It is obvious that this is a field/value for your use, and that is a whole different story.

    You can concoct any field or combinations of fields for your use in Queries, Forms or Reports, but
    you are just kidding yourself if you think this field in this format is needed by Access.

    You should work on getting a clear, defined set of business rules so that you can create and structure your tables and relationships to support your business. This is the critical step in getting an easy to use,easy to maintain useful data base.

    As posted before:
    You should read this article on database principles.
    http://forums.aspfree.com/attachment...achmentid=4712

    Good luck with your project.
    Last edited by orange; 08-12-2012 at 07:43 AM. Reason: spelling

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

Similar Threads

  1. Merging data
    By jaZZerkill in forum Access
    Replies: 1
    Last Post: 04-09-2012, 08:43 AM
  2. Replies: 7
    Last Post: 09-15-2011, 01:58 PM
  3. Replies: 8
    Last Post: 11-04-2009, 04:22 AM
  4. Replies: 1
    Last Post: 03-02-2009, 10:12 PM
  5. Can we post Access cell data to Excel cell properties?
    By Zethro in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2005, 08:42 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