Query and Subquery help request

IvenBach

Board Regular
Joined
May 31, 2008
Messages
212
I am trying to move the information I'm using as a database from Excel into Access. I've tried to normalize (I think that's the correct term) my data and create separate tables. What I would like to do is concatenate all the fields (columns) into 1 using a subquery but I have no experience with access and am really struggling. I managed to make a query that creates the basic table and populates it with the correct information.

Below is a UDF in excel that will do what I want but don't know where to begin Access. This is essentially building a list item group to list product features on a website.
Code:
Function FeaturesBuild(rngRange As Range)
Dim r As Range
    For Each r In rngRange
        If r.Value <> "" Then FeaturesBuild = FeaturesBuild & "LI" & r.Value & "/LI" & Chr(10)
    Next
End Function

'LI should be html format but doesn't display properly.
I have tried to use the IIF function in Access but it would take the total records on my database and square it (for me was 650^2=422,500) or by playing with it would give me a multiple of the type of data I was working with.

<table align="center" border="1"> <tbody><tr> <td>ID</td> <td>Product Code</td> <td>Body Information</td> <td>Bezel Color</td> <td>Face Color</td> <td>Additional Fields....</td> <td>Concatenated Field Desired</td> </tr> <tr> <td>1</td> <td>Example 1</td> <td>Product Information</td> <td>Black</td> <td>Black</td> <td>More Info</td> <td>Black - Black - More Info</td> </tr> </tbody></table>
 
Last edited:
Working like I originally wanted to. :laugh: Thanks for that initial help. I've one last question since you mentioned my multiple tables. In your experience would it be better to have a single ID Table that would hold the information for each field and have everything based off of the an Autonumber primary key? I ask since my assumptions at times can lead to unnecessary work and time lost.
Code:
<table border="1"><tbody><tr><th colspan="5">tblKey_Table</th></tr><tr><th>ID
          </th><th>Bezel Color
          </th><th>Dimension
          </th><th>Face Color
          </th><th>Operation
     </th></tr><tr><td>1</td><td>Chrome</td><td>2-1/16" (52.4mm)</td><td>Beige</td><td>Short Sweep Electric</td></tr><tr><td>2</td><td>Gold</td><td>1-1/2" (38.1mm)</td><td>Silver</td><td>Mechanical</td></tr><tr><td>etc...</td><td>...</td><td>...</td><td>...</td><td>...
</td></tr> </tbody></table>
Thank you very much for all the back and forth and any blatant obvious things I've missed or missing.

Edit: If there were 2 fields for Operation it was most likely an error on my part.
If the table you posted is what you are considering then definitely no.

I'm not even sure what the purpose if a table like that could/would be.

It just seems to be repeating data.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top