Hello. I am not sure if there is a way to improve performance. When I click on the button to query the link tables, it takes like 4 to 5 minutes to return one row. I am not sure if I am doing something wrong or if there is another trick to improve the performance. Below is a code that looks like what I have.
Below codes are in Private Sub cmdQuery_Click()
Dim strSQL As String
' Columns
strSQL = "Select Top 10 "
strSQL = strSQL + "P.Field1, "
strSQL = strSQL + "R.field2, "
strSQL = strSQL + "P.Field3 "
' Can't do inner join
strSQL = strSQL + "From Table1 R, Table2 P "
'Where Clause
strSQL = strSQL + "Where P.= Field1'" + Nz(Me.cmbPlan.Value) + "' "
strSQL = strSQL + "and R.Field1= P.Field1"
'ReceiverType
If Nz(Me.cmbRec.Value) <> "" Then
strSQL = strSQL + "and R.Field3= '" + Nz(Me.cmbRec.Value) + "' "
End If
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("qryResult")
qdf.SQL = strSQL
DoCmd.OpenQuery ("qryResult")
Set qdf = Nothing