W
winsa
Hi
I hope I have posted this in the right place.
I have a query using three tables (see below). Simply viewing the query is
not an issue, however, when I use it as the recordsource for a form, Access
only pulls up the first 50 records, then the rest after a pause. This is
creating havoc with some code that uses Recordset bookmarks. In a custom
"Record x of y" display, it only displays "Record *whatever* of 50" until I
click on the navigation buttons, and then it displays the correct total
record number. In my custom search function, it cannot find any of the
records above 51.
I have read the article from MS regarding query optimisation, but no luck
there. Does it have something to do with the multi-table query in that a
many-to-many relationship is formed because tbl_DEBTORS and tbl_PACODE are
both lookup tables?!?!
Can anyone offer any suggestions or explanations as to why Access is doing
this?
The query SQL is as follows:
SELECT TOP 100 PERCENT tbl_PAMASTER.PAPOLICY_IDX, tbl_PAMASTER.DEBTOR_IDX,
tbl_DEBTORS.DBTR_NAME, tbl_PAMASTER.PAI_CONGREGATION,
tbl_PAMASTER.PAI_INSUREDFIRST, tbl_PAMASTER.PAI_INSUREDINITIAL,
tbl_PAMASTER.PAI_INSUREDLAST, tbl_PAMASTER.PAI_DOB, (CAST(CONVERT(CHAR(8),
CURRENT_TIMESTAMP, 112) AS INT) - CAST(CONVERT(CHAR(8), tbl_PAMASTER.PAI_DOB,
112) AS INT)) / 10000 AS PAI_AGE, tbl_PAMASTER.PACODE_IDX,
tbl_PACODES.PAI_COVER_DESC, tbl_PACODES.PAI_CAPITAL, tbl_PACODES.PAI_WEEKS,
tbl_PACODES.PAI_ACCIDENT, tbl_PACODES.PAI_ILLNESS, tbl_PACODES.PAI_PRM,
tbl_PAMASTER.FORM_P, tbl_PAMASTER.PAMSTR_NOTES, tbl_DEBTORS.ADD_1,
tbl_DEBTORS.ADD_2, tbl_DEBTORS.TOWN, tbl_DEBTORS.STATE, tbl_DEBTORS.PCODE
FROM tbl_PAMASTER INNER JOIN tbl_PACODES ON tbl_PAMASTER.PACODE_IDX =
tbl_PACODES.PACODE_IDX INNER JOIN
tbl_DEBTORS ON tbl_PAMASTER.DEBTOR_IDX = tbl_DEBTORS.DEBTOR_IDX
ORDER BY tbl_PAMASTER.PAPOLICY_IDX
Thanking you in advance.
I hope I have posted this in the right place.
I have a query using three tables (see below). Simply viewing the query is
not an issue, however, when I use it as the recordsource for a form, Access
only pulls up the first 50 records, then the rest after a pause. This is
creating havoc with some code that uses Recordset bookmarks. In a custom
"Record x of y" display, it only displays "Record *whatever* of 50" until I
click on the navigation buttons, and then it displays the correct total
record number. In my custom search function, it cannot find any of the
records above 51.
I have read the article from MS regarding query optimisation, but no luck
there. Does it have something to do with the multi-table query in that a
many-to-many relationship is formed because tbl_DEBTORS and tbl_PACODE are
both lookup tables?!?!
Can anyone offer any suggestions or explanations as to why Access is doing
this?
The query SQL is as follows:
SELECT TOP 100 PERCENT tbl_PAMASTER.PAPOLICY_IDX, tbl_PAMASTER.DEBTOR_IDX,
tbl_DEBTORS.DBTR_NAME, tbl_PAMASTER.PAI_CONGREGATION,
tbl_PAMASTER.PAI_INSUREDFIRST, tbl_PAMASTER.PAI_INSUREDINITIAL,
tbl_PAMASTER.PAI_INSUREDLAST, tbl_PAMASTER.PAI_DOB, (CAST(CONVERT(CHAR(8),
CURRENT_TIMESTAMP, 112) AS INT) - CAST(CONVERT(CHAR(8), tbl_PAMASTER.PAI_DOB,
112) AS INT)) / 10000 AS PAI_AGE, tbl_PAMASTER.PACODE_IDX,
tbl_PACODES.PAI_COVER_DESC, tbl_PACODES.PAI_CAPITAL, tbl_PACODES.PAI_WEEKS,
tbl_PACODES.PAI_ACCIDENT, tbl_PACODES.PAI_ILLNESS, tbl_PACODES.PAI_PRM,
tbl_PAMASTER.FORM_P, tbl_PAMASTER.PAMSTR_NOTES, tbl_DEBTORS.ADD_1,
tbl_DEBTORS.ADD_2, tbl_DEBTORS.TOWN, tbl_DEBTORS.STATE, tbl_DEBTORS.PCODE
FROM tbl_PAMASTER INNER JOIN tbl_PACODES ON tbl_PAMASTER.PACODE_IDX =
tbl_PACODES.PACODE_IDX INNER JOIN
tbl_DEBTORS ON tbl_PAMASTER.DEBTOR_IDX = tbl_DEBTORS.DEBTOR_IDX
ORDER BY tbl_PAMASTER.PAPOLICY_IDX
Thanking you in advance.