Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset and query generates rows of same data

Status
Not open for further replies.

katoc

Programmer
Feb 15, 2005
52
0
0
US
There is a table on the Oracle server that I link to using ODBC, OrderDetails, and another table in my Access Database that I'm using in a query together, Order. i've built this as a Query and as a recordset in my VBA code and it should return different 37 rows but it returns 37 rows that look like copies of the first row.

Query:
Code:
select OrderDetails.*
from Order
    Inner Join OrderDetails on Order.id = OrderDetails.OrderId
where Order.id = 12345;
This returns 37 rows of:
OrderId Item Cost
12345 Bread 2
12345 Bread 2
12345 Bread 2
12345 Bread 2
12345 Bread 2
....

when it should return:
OrderId Item Cost
12345 Bread 2
12345 Coffee 4
12345 Milk 3
...

When I instead run an Make-Table query, it does add the correct 37 distinct rows to a new table. I can't figure out why I'm receiving the first result of same rows by running the query. Help please!
 
Anyway, why not simply this ?
select *
from OrderDetails
where OrderId = 12345;

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I did and received the same results. Same rows. Itseems only inserting the results to a table gives me the correct result.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top