I've written a query that pulls data from 2 tables based on a set of criteria and places it in a temp table. I then need to group this data on several fields and have it show on a report with the grouping. So far everything is fine except when the code gets to a specific place - it hangs on the rptDetail.Show. The temp table that the query makes is only 125 records but it tabke over 5 minutes for the report to show with the data. How do I trouble shoot why this is taking so long?
Here is the code to make the temp table:
SELECT tblEntry.ID, tblEntry.AcctNum, tblEntry.CutOff, tblEntry.Code, tblEntry.EntryDate, tblEntry.LanID, tblEntry.CheckNo, tblEntry.CreditAmt, tblEntry.CreditDate, tblEntry.DebitAmt, tblEntry.DebitDate, tblEntry.AmtDiff, tblEntry.Memo, tblSystemHeaders.ID AS Expr1, tblSystemHeaders.Code AS Expr2, tblSystemHeaders.ExpDet,
tblSystemHeaders.Heading, tblSystemHeaders.lblCheckNo, tblSystemHeaders.lblCreditAmt, tblSystemHeaders.lblCreditDate,
tblSystemHeaders.lblDebitAmt, tblSystemHeaders.lblDebitDate, tblSystemHeaders.lblAmtDiff,
tblSystemHeaders.lblMemo INTO tblReport
FROM tblEntry LEFT OUTER JOIN tblSystemHeaders ON tblEntry.Code = tblSystemHeaders.Code
WHERE (tblEntry.AcctNum = '" & Trim(txtAcctNum) & "') AND
tblEntry.CutOff = '" & Trim(cboCutOff) & "')
cnnREX.Execute strSQLREX
Then the data environment takes over with a cmdGrouping:
SELECT Code, CheckNo, CreditAmt, CreditDate, DebitAmt, DebitDate, AmtDiff, Memo, ExpDet, Heading, lblCheckNo, lblCreditAmt,lblCreditDate, lblDebitAmt, lblDebitDate, lblAmtDiff, lblMemo
FROM tblReport
GROUP BY Code, CheckNo, CreditAmt, CreditDate, DebitAmt,
DebitDate, AmtDiff, Memo, ExpDet, Heading, lblCheckNo,
lblCreditAmt, lblCreditDate, lblDebitAmt, lblDebitDate,
lblAmtDiff, lblMemo
ORDER BY Code
Once that data is grouped then:
If DataEnvironment1.rscmdREXGroup_Grouping.State <> 0 Then DataEnvironment1.rscmdREXGroup_Grouping.Close
DataEnvironment1.rscmdREXGroup_Grouping.Open
rptRexDetail.Sections(1).Controls("lblAcctNum"
.Caption = txtAcctNum
rptRexDetail.Sections(1).Controls("lblCutOff"
.Caption = cboCutOff
rptRexDetail.Show
As soon as it gets to the rptRexDetail.Show it hangs.
Can anyone give me a better alternative to what I have here? I think that because I needed to put the grouping in that this has become very convoluted and I'm now making more work for myself and the app.
Thanks,
Corinne
Here is the code to make the temp table:
SELECT tblEntry.ID, tblEntry.AcctNum, tblEntry.CutOff, tblEntry.Code, tblEntry.EntryDate, tblEntry.LanID, tblEntry.CheckNo, tblEntry.CreditAmt, tblEntry.CreditDate, tblEntry.DebitAmt, tblEntry.DebitDate, tblEntry.AmtDiff, tblEntry.Memo, tblSystemHeaders.ID AS Expr1, tblSystemHeaders.Code AS Expr2, tblSystemHeaders.ExpDet,
tblSystemHeaders.Heading, tblSystemHeaders.lblCheckNo, tblSystemHeaders.lblCreditAmt, tblSystemHeaders.lblCreditDate,
tblSystemHeaders.lblDebitAmt, tblSystemHeaders.lblDebitDate, tblSystemHeaders.lblAmtDiff,
tblSystemHeaders.lblMemo INTO tblReport
FROM tblEntry LEFT OUTER JOIN tblSystemHeaders ON tblEntry.Code = tblSystemHeaders.Code
WHERE (tblEntry.AcctNum = '" & Trim(txtAcctNum) & "') AND
tblEntry.CutOff = '" & Trim(cboCutOff) & "')
cnnREX.Execute strSQLREX
Then the data environment takes over with a cmdGrouping:
SELECT Code, CheckNo, CreditAmt, CreditDate, DebitAmt, DebitDate, AmtDiff, Memo, ExpDet, Heading, lblCheckNo, lblCreditAmt,lblCreditDate, lblDebitAmt, lblDebitDate, lblAmtDiff, lblMemo
FROM tblReport
GROUP BY Code, CheckNo, CreditAmt, CreditDate, DebitAmt,
DebitDate, AmtDiff, Memo, ExpDet, Heading, lblCheckNo,
lblCreditAmt, lblCreditDate, lblDebitAmt, lblDebitDate,
lblAmtDiff, lblMemo
ORDER BY Code
Once that data is grouped then:
If DataEnvironment1.rscmdREXGroup_Grouping.State <> 0 Then DataEnvironment1.rscmdREXGroup_Grouping.Close
DataEnvironment1.rscmdREXGroup_Grouping.Open
rptRexDetail.Sections(1).Controls("lblAcctNum"
rptRexDetail.Sections(1).Controls("lblCutOff"
rptRexDetail.Show
As soon as it gets to the rptRexDetail.Show it hangs.
Can anyone give me a better alternative to what I have here? I think that because I needed to put the grouping in that this has become very convoluted and I'm now making more work for myself and the app.
Thanks,
Corinne