I'm having problem figuring out how to display some data I need on a report. I have tried two different methods:
1)I wrote a series of queries to feed into a subreport. When I ran the queries on a small sample it worked just fine, but when I ran it on the real data(more than 80 fields, more than 700 rows), the 3rd query took way, way too long which made linking it to my subreport impossible, and it uses most if not all of the computing power(my computer is not super powerful, but it is fairly decent). I've made examples of the first 3 queries to give you an idea:
Query1:
SELECT Orders.OrderID AS OrI, Orders.OrderName AS OrN FROM Orders;
(This is in order to compare OrderID against itself in the next query.)
Query2:
SELECT DISTINCT Orders.OrderID, Query1.OrI+' '+Query1.OrN AS NewOrderName
FROM Orders INNER JOIN Query1 ON (Query1.OrI) Like (Orders.OrderID+'*')
WHERE LEN(Orders.OrderID)>0 And INSTR(LEN(Orders.OrderID)+2,(Query1.OrI),"a certain subtring")=0;
Query3:
SELECT Orders.OrderID, Orders.OtherField AS NewOtherField FROM Orders WHERE Orders.OrderID NOT IN (Select [Query2].OrderID FROM [Query2]);
2) I have tried using both subreports and subforms to feed the data in. Access allows you to do this, but unlike the forms I have developed using vba in the past, I can't figure out how to get Access/vba to let me communicate between the report and the subreport/subform in either direction. I'm also having problems communicating directly with the subform/report (from the vba code). I've tried everything I found in the books I have, Access/vba help, and the internet, and I'm stuck.
Any help? Ideas on either method would be greatly appreciated.
Thanks,
Jenni
1)I wrote a series of queries to feed into a subreport. When I ran the queries on a small sample it worked just fine, but when I ran it on the real data(more than 80 fields, more than 700 rows), the 3rd query took way, way too long which made linking it to my subreport impossible, and it uses most if not all of the computing power(my computer is not super powerful, but it is fairly decent). I've made examples of the first 3 queries to give you an idea:
Query1:
SELECT Orders.OrderID AS OrI, Orders.OrderName AS OrN FROM Orders;
(This is in order to compare OrderID against itself in the next query.)
Query2:
SELECT DISTINCT Orders.OrderID, Query1.OrI+' '+Query1.OrN AS NewOrderName
FROM Orders INNER JOIN Query1 ON (Query1.OrI) Like (Orders.OrderID+'*')
WHERE LEN(Orders.OrderID)>0 And INSTR(LEN(Orders.OrderID)+2,(Query1.OrI),"a certain subtring")=0;
Query3:
SELECT Orders.OrderID, Orders.OtherField AS NewOtherField FROM Orders WHERE Orders.OrderID NOT IN (Select [Query2].OrderID FROM [Query2]);
2) I have tried using both subreports and subforms to feed the data in. Access allows you to do this, but unlike the forms I have developed using vba in the past, I can't figure out how to get Access/vba to let me communicate between the report and the subreport/subform in either direction. I'm also having problems communicating directly with the subform/report (from the vba code). I've tried everything I found in the books I have, Access/vba help, and the internet, and I'm stuck.
Any help? Ideas on either method would be greatly appreciated.
Thanks,
Jenni