Query Advice

D

Dan

I have a form that has a subform on it but it is running really slow. It
takes a couple of seconds to load the form and a couple of seconds to flip
each record. I am wondering if there is a way to speed things up.

I expermented with a couple of things and it seems like the query that is
connected to the subform is causing it to run slow. It is a union query and
the form is connected to the subform by its primary key. I took out half of
the query (from the union down) and everything ran really fast.

In one of our tables, table1, we have information about some products. Which
we match togeather and store in table2. Just the two products primary key is
stored. The subform displays the products that the selected product has been
matched with.

So I was wondering if there is an better way to write the query. I thought
about just adding each of the matched products to table2 twice so I wouldn't
have to have a union query but then we would have twice the number of
records.

Any advice would be appreciated
 
D

Dan

I almost forgot to post my query:

SELECT O1.[ID], Table2.DateMatched & " " & O2.[Name] O2.[ID]
FROM ([Table1] AS O1 INNER JOIN Table2 ON O1.[ID] = Table2.wID) INNER JOIN
[Table1] AS O2 ON O2.[ID]=Table2.mID;
UNION
SELECT SELECT O1.[ID], Table2.DateMatched & " " & O2.[Name] O2.[ID]
FROM ([Table1] AS O1 INNER JOIN MATCHES ON O1.[ID] = Table2.mID) INNER JOIN
[Table1] AS O2 ON O2.[ID] = Table2.wID;

I have tried several similar queries with no luck
 
Top