Tony Bills
11-27-2001, 10:46 AM
I have a form that shows various configurations of systems. "System A" would show various "Components" and associated with each component is a series of numbers. The query may yield, say, "1, 5, 7 ,9" for a particular "Component" or, say, "5,11" for another.
Each of these numbers is displayed in its own row duplicating the Component information on each of those rows.
Component A - 1
Component A - 5
Component A - 7
Component A - 9
I want to have one row of component information that includes a text box that lists those numbers with seperators such as commas.
Component A - 1,5,7,9
Can this be done?
Jack Cowley
11-27-2001, 02:31 PM
You should create another table for your 'series of numbers' and relate this to your Component table in a One to Many relationship. One Component, Many Numbers. You can create a Form/Subform combination to show your Component in the Main form and the associated 'numbers' for that Component in the Subform. You are, in my opinion, asking for trouble if you store your numbers in one field i.e. 1,3,7,4,11....
Tony Bills
11-27-2001, 04:01 PM
Jack,
Thanks for the input!! However, be aware that these numbers are, indeed, coming from a table with a one-to-many relationship to the "Component". I have a query that pulls this all together for the particular components.
My issue is a form display issue: once my query produces this set of numbers - how can I display this set in a box on a single row separated by commas. I want each component to have a single row with a text box that contains the list of associated numbers.
In my scenario, a system could have 30 components and each of those components might have 5 to 10 numbers associated. This makes for big scrolling form where component A is listed at least 5 times. My customers find this unruly and don't understand why each component doesn't just list its numbers on the same row. (there is certainly room for this)
I am guessing that this is going to take some code which is a weak spot for me. I assume that I will have to have a conditional loop that looks to see if there is another record while building the list with commas between and then making that the contents of a text box.
I have tried a cross tab query but this doesn't work for variable list lengths and then there are the column headings - well, that just got real messy.
Thanks for your input. I appreciate the fact that you took an interest in my problem.
Tony
Jack Cowley
11-27-2001, 05:15 PM
You are correct. You will need to loop through the query to build your string of numbers. Look at this bit of code as an example of what you need to do to produce your string.
http://www.access-programmers.co.uk/ubb/Forum1/HTML/005935.html