Results 1 to 5 of 5
  1. #1
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305

    Best way to merge multiple columns of a Table into one for Reports

    I'll try to explain this the best I can. Basically I've got a form on a website that lets my managers report incidents at their store. They select a primary category, and then the that splits into sub categories.



    This is relevant as this online form automatically feeds into an access form. Its great, I've got forms and reports all feeding off this. My only issue is that these sub categories all have their own individual column in my table. Meaning I'll have data in one column for an entry and then all the other sub category columns are empty.

    Makes it very hard to incorporate sub category data into a form or report.

    Does anyone know the best way to combine all the sub category data into one column? I do not want to change my online form, nor my table design. I know that might be the easier way, but this is such a well working system so far. I don't want to change everything because of this.

    I am open to any way to capture this info all into one column
    Attached Thumbnails Attached Thumbnails Capture.PNG  

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I do not want to change my online form, nor my table design. I know that might be the easier way, but this is such a well working system so far. I don't want to change everything because of this.
    Actually, it is the contrary. You just proved that this is NOT working well. You have a table design that is not normalized. When you do that, seemingly simple tasks and made much more difficult.
    The rules of normalization say you should never have repeating similar fields in a table design. Rather, than having four Sub-Category fields, you would have one Sub Category Number field, and one Sub Category Value field. So, if a particular record had multiple Sub-Categories, instead of having one record with two Sub-Category fields filled out, you would have two distinct records.

    While that may seem counter intuitive, think of the ramifications. Here is a real world example. Let's say that you had to locate all records that have a certain Sub Category value. In your example, you would need to search four different fields. In the normalized structure, you would only need to search one. Searching four fields might not seem like that big of a deal, but what if you had 20 Sub Category fields? Then it becomes a nightmare!

    Also, the normalized structure allows for growth without having to edit your table design (i.e. add new fields). In the normalized design, all you have to do to add more Sub Categories is to add new records to the existing table.
    In your design, you would have to add new fields to all tables, queries, forms, and reports that use those fields. Once again, creating a potential nightmare scenario just to add more fields.

    Being down the road that you currently are on, I would highly recommend changing your table structure. Yes, it will be a little more work up front, but save you down the road. You may be able to simplify it further, depending on a few details, such as:
    - Do any records actually have more than one Sub Category field filled out? Can they?
    - In your example, I noticed that all Sub Category 1 records have the same value ("Employee Fall"), and the same is true for the other 3. Can they ever differ, or is each Sub Category number associated with just one single value?

    If you really do not want to change anything, and each record will only have one Sub-Category field filled out, you could do a calculated field like:
    Code:
    SubCategory: [Sub- Category 1] & [Sub Category 2] & [Sub Category 3] & [Sub Category 4]

  3. #3
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305
    I understand that, in theory, having one sub category makes more sense. I totally get that.

    However, the web application I'm using links into Access perfectly. And there is simply no way to make the online application feed into Access with only one sub-category. It's simply not possible. The table structure is a reflection of the web application.

    I do not want to change my entire web application because of this issue. I'm merely asking if there is a work around way of collecting all the sub category data into one column, strictly for reporting use.

    I will try the code you recommended. Thanks!

  4. #4
    templeowls is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2019
    Posts
    305
    And each entry will only ever have one sub category filled out. And they never differ. So if there's data in sub-category 1, it will always be "employee fall" or else it will be blank.

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Try a UNION query to get un-normalized columnar data into one field; it's the usual approach.
    Would be interesting to know what this "web application" is that imposes such an impediment. Surely it's not a web based Access database? If not, perhaps you should be mining it for data and normalizing it in Access so that you can work on it without having to develop work-arounds all the time.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Save reports as PDF then merge into 1 PDF
    By tgall in forum Reports
    Replies: 1
    Last Post: 02-19-2016, 02:50 PM
  2. Replies: 1
    Last Post: 05-21-2013, 12:02 PM
  3. Replies: 4
    Last Post: 10-15-2012, 02:43 PM
  4. Reports, Word and merge
    By Wayne311 in forum Reports
    Replies: 7
    Last Post: 02-12-2011, 06:29 PM
  5. merge multiple entries in table
    By rajsa in forum Database Design
    Replies: 1
    Last Post: 07-02-2010, 07:16 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