I have a vendor table and a vendorCommodity table that has a one to many relationship. I need to export the data with some of the vendor table fields and one new field that contains all of the vendor's commodityCodes (from multiple records) into one field separated by a comma.
I thought I would create a new table and load the information into it.
Example of data:
Vendor Name: Commodity Code:
Bob's Services 12-323
12-330
14-120
John's Goods 01-331
03-424
Barry's Repairs 15-222
Will's Rentals 13-565
11-444
02-112
Desired output:
Vendor Name Commodity Codes
Bob's Services 12-323, 12-330, 14-120
John's Goods 01-331, 03-424
Barry's Repairs 15-222
Will's Rentals 13,565, 11-444, 02-112
My approach was to load the vendor table data into the new table with an append query, then update the new single commCode field with the concatenated commodity records from the vendorCommodity table. I can't seem to get an expression to concatenate the fields for each vendor.
I have tried this expression:
ExpCombinedComcodes: [ExpCombinedComcodes]+", "+[TblVendCommodity].[ComCode]
I get an error message with it:
"Circular reference cause by alias 'ExpCombinedComcodes'in query definition select list.
Perhaps my whole approach is wrong.
Any suggestions are greately appreciated.
Thanks,
MrBill
I thought I would create a new table and load the information into it.
Example of data:
Vendor Name: Commodity Code:
Bob's Services 12-323
12-330
14-120
John's Goods 01-331
03-424
Barry's Repairs 15-222
Will's Rentals 13-565
11-444
02-112
Desired output:
Vendor Name Commodity Codes
Bob's Services 12-323, 12-330, 14-120
John's Goods 01-331, 03-424
Barry's Repairs 15-222
Will's Rentals 13,565, 11-444, 02-112
My approach was to load the vendor table data into the new table with an append query, then update the new single commCode field with the concatenated commodity records from the vendorCommodity table. I can't seem to get an expression to concatenate the fields for each vendor.
I have tried this expression:
ExpCombinedComcodes: [ExpCombinedComcodes]+", "+[TblVendCommodity].[ComCode]
I get an error message with it:
"Circular reference cause by alias 'ExpCombinedComcodes'in query definition select list.
Perhaps my whole approach is wrong.
Any suggestions are greately appreciated.
Thanks,
MrBill