Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #10406 > unrolled thread
| Started by | csavedgeebay@gmail.com |
|---|---|
| First post | 2015-02-24 06:51 -0800 |
| Last post | 2015-03-01 08:11 -0500 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.databases.ms-access
Repeating data in Query result csavedgeebay@gmail.com - 2015-02-24 06:51 -0800
Re: Repeating data in Query result Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-02-24 08:59 -0800
Re: Repeating data in Query result csavedgeebay@gmail.com - 2015-02-24 09:08 -0800
Re: Repeating data in Query result Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-02-24 11:34 -0800
Re: Repeating data in Query result "Ron Paii" <None@none.com> - 2015-02-24 11:28 -0600
Re: Repeating data in Query result Norman Peelman <npeelman@cfl.rr.com> - 2015-03-01 08:11 -0500
| From | csavedgeebay@gmail.com |
|---|---|
| Date | 2015-02-24 06:51 -0800 |
| Subject | Repeating data in Query result |
| Message-ID | <1d846e68-473e-4578-90c5-40debd53e6cd@googlegroups.com> |
I've created a query to show open PO's. The issue is there can be multiple open PO's for one item. In the Query result I would just like to see the item and item identifying information once with the multiple open PO numbers. However, when I add in the open PO numbers my item information begins to repeat. Is there anything I can do about this?
Example of what I would like to see:
Item: Desc: Open PO NUM:
567589 Oxcarb 345
568
554
445
678
Next item.
[toc] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2015-02-24 08:59 -0800 |
| Message-ID | <655ba9ac-c556-4f16-9bd6-06cc0739b149@googlegroups.com> |
| In reply to | #10406 |
On Tuesday, February 24, 2015 at 9:51:19 AM UTC-5, csaved...@gmail.com wrote: > I've created a query to show open PO's. The issue is there can be multiple open PO's for one item. In the Query result I would just like to see the item and item identifying information once with the multiple open PO numbers. However, when I add in the open PO numbers my item information begins to repeat. Is there anything I can do about this? > > Example of what I would like to see: > > Item: Desc: Open PO NUM: > 567589 Oxcarb 345 > 568 > 554 > 445 > 678 > > Next item I do not see how you can do that in a query.
[toc] | [prev] | [next] | [standalone]
| From | csavedgeebay@gmail.com |
|---|---|
| Date | 2015-02-24 09:08 -0800 |
| Message-ID | <b3cd38b3-7127-4afd-aba2-e162bf5c6bfa@googlegroups.com> |
| In reply to | #10408 |
Do you think I could do this within a table? Do you have any suggestions? On Tuesday, February 24, 2015 at 11:59:38 AM UTC-5, Patrick Finucane wrote: > On Tuesday, February 24, 2015 at 9:51:19 AM UTC-5, csaved...@gmail.com wrote: > > I've created a query to show open PO's. The issue is there can be multiple open PO's for one item. In the Query result I would just like to see the item and item identifying information once with the multiple open PO numbers. However, when I add in the open PO numbers my item information begins to repeat. Is there anything I can do about this? > > > > Example of what I would like to see: > > > > Item: Desc: Open PO NUM: > > 567589 Oxcarb 345 > > 568 > > 554 > > 445 > > 678 > > > > Next item > > I do not see how you can do that in a query.
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2015-02-24 11:34 -0800 |
| Message-ID | <c17d6538-402a-46a9-90c9-711a2ac921cb@googlegroups.com> |
| In reply to | #10409 |
On Tuesday, February 24, 2015 at 12:08:58 PM UTC-5, csaved...@gmail.com wrote: > Do you think I could do this within a table? Do you have any suggestions? > > > On Tuesday, February 24, 2015 at 11:59:38 AM UTC-5, Patrick Finucane wrote: > > On Tuesday, February 24, 2015 at 9:51:19 AM UTC-5, csaved...@gmail.com wrote: > > > I've created a query to show open PO's. The issue is there can be multiple open PO's for one item. In the Query result I would just like to see the item and item identifying information once with the multiple open PO numbers. However, when I add in the open PO numbers my item information begins to repeat. Is there anything I can do about this? > > > > > > Example of what I would like to see: > > > > > > Item: Desc: Open PO NUM: > > > 567589 Oxcarb 345 > > > 568 > > > 554 > > > 445 > > > 678 > > > > > > Next item > > > > I do not see how you can do that in a query. Not within a table. With a form. I'd probably use a listbox to present the values. A report can hide duplicate values but I doubt that's what you want.
[toc] | [prev] | [next] | [standalone]
| From | "Ron Paii" <None@none.com> |
|---|---|
| Date | 2015-02-24 11:28 -0600 |
| Message-ID | <mcicad$t67$1@dont-email.me> |
| In reply to | #10406 |
<csavedgeebay@gmail.com> wrote in message news:1d846e68-473e-4578-90c5-40debd53e6cd@googlegroups.com... > I've created a query to show open PO's. The issue is there can be > multiple open PO's for one item. In the Query result I would just like to > see the item and item identifying information once with the multiple open > PO numbers. However, when I add in the open PO numbers my item > information begins to repeat. Is there anything I can do about this? > > Example of what I would like to see: > > Item: Desc: Open PO NUM: > 567589 Oxcarb 345 > 568 > 554 > 445 > 678 > > Next item. Use SELECT DISTINCT to remove the duplicates. Use a form or report to format and display the data.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2015-03-01 08:11 -0500 |
| Message-ID | <mcv34e$7br$1@dont-email.me> |
| In reply to | #10406 |
On 02/24/2015 09:51 AM, csavedgeebay@gmail.com wrote:
> I've created a query to show open PO's. The issue is there can be multiple open PO's for one item. In the Query result I would just like to see the item and item identifying information once with the multiple open PO numbers. However, when I add in the open PO numbers my item information begins to repeat. Is there anything I can do about this?
>
> Example of what I would like to see:
>
> Item: Desc: Open PO NUM:
> 567589 Oxcarb 345
> 568
> 554
> 445
> 678
>
> Next item.
>
This could be done with a little VBA:
SELECT Item, Desc, Concat("SELECT po_num FROM item_id, po_table WHERE
po_id = item_id ORDER BY po_num ASC", "po_num", "|") AS [Open PO Num]
FROM item_table
<WHERE item_id = ???>
Where Concat() is a function (in a module) that runs the given query (as
above) and joins the results into a single string that is returned to
the original query:
Function Concat(sub_select as string, field as string, delimeter as string)
dim db as Database
dim recset as RecordSet
dim recs as integer
dim tmp as string
set db = CurrentDB
recset = db.Execute(sub_select)
if (recset.Count = 0)
tmp = "None"
else
for recs = 1 to recset.Count
tmp = tmp & recset.Fields(field).Value & delimeter
next recs
' remove trailing *delimeter*
tmp = Left(tmp, Len(tmp)-1)
end if
set recset = nothing
set db = nothing
Concat = tmp
End Function
Example output:
Item: Desc: Open PO NUM:
567589 Oxcarb 345|568|554|445|678
.
.
.
This code could be made more robust for sure. Google 'access concat
function' or similar for more/better examples as I've just jotted this
out off the top of my heda this morning.
--
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.ms-access
csiph-web