|
-
Jun 26th, 2003, 05:28 AM
#1
Thread Starter
Addicted Member
SQL ...speed up the opening
VB Code:
sSQL = "SELECT DISTINCT "
sSQL = sSQL & "QTempCredit.Credit_Note_Number, "
sSQL = sSQL & "QTempCredit.Employer_Ref, "
sSQL = sSQL & "QTempCredit.Client_Ref, "
sSQL = sSQL & "QTempCredit.Client_Name, "
sSQL = sSQL & "QTempCredit.Personnel_Ref, "
sSQL = sSQL & "QTempCredit.Dept_Description, "
sSQL = sSQL & "QTempCredit.Division_Description, "
sSQL = sSQL & "QTempCredit.Timesheet_Number, "
sSQL = sSQL & "QTempCredit.Credit_Note_Date, "
sSQL = sSQL & "QPSTran.[Acctg Date], "
sSQL = sSQL & "QTempCredit.Details, "
sSQL = sSQL & "QTempCredit.Description, "
sSQL = sSQL & "QTempCredit.Credit_Note_Net, "
sSQL = sSQL & "QTempCredit.Credit_Note_VAT, "
sSQL = sSQL & "QTempCredit.Credit_Note_Total, "
sSQL = sSQL & "QTempCredit.Page, "
sSQL = sSQL & "QTempCredit.Line "
sSQL = sSQL & "FROM QPSTran "
sSQL = sSQL & "INNER JOIN QTempCredit ON (QPSTran.Customer = QTempCredit.Client_Ref) "
sSQL = sSQL & "AND (QPSTran.[Item ID] = QTempCredit.Credit_Note_Number) "
sSQL = sSQL & (QTempCredit.Credit_Note_Date >= '20030501' sSQL = sSQL & AND QTempCredit.Credit_Note_Date <= '20030626') AND (QTempCredit.Client_Ref = 'GAME02')
sSQL = sSQL & "ORDER BY QTempCredit.Credit_Note_Number, QTempCredit.Page, QTempCredit.Line"
rstCrNote.Open sSQL, cnSQL, adOpenForwardOnly, adLockReadOnly
I am using ADO to connect to an Access Table which has a couple of linked tables in it (the reason is there is Tables coming from 2 different SQL Databases) QTempCredit is a Query as is QPSTran.
the problem is it is taking so long to open the recordset. Am i missing something is there someway to speed this up???
Thanks
in advance
-
Jun 26th, 2003, 05:34 AM
#2
Hyperactive Member
The only way you could really speed this up is by looking at your index's
-
Jun 26th, 2003, 05:40 AM
#3
Thread Starter
Addicted Member
Thanks, but i cant really change the indexs as the databases belong to the accounts systems which where bought externally, (the one DB whowever built the database should be drawn and quatered.. ) I thought maybe i had skipped something or was over looking something .... thanks
-
Jun 26th, 2003, 08:41 AM
#4
Lively Member
To put it in context, how many records are in each table and how long is it taking?
-
Jun 26th, 2003, 10:07 AM
#5
I would try reversing the table links. Its obvious your main table/query is the QTempCredit. All your selection criterions are based on this table.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|