Reputation: 63
I need to use a fairly complex multiple table query as the data-source for a continuous form, but have the form remain editable. All of the form fields that I need to edit are only linked to a single table but I still need to display information from the multi-table query in a few of the fields in a non-editable fashion. I have accomplished this using DLookUp in the Record source query for the "display only" fields, but the performance is abysmal since the database is split and the backed resides on a server with linked tables. If I accomplish the same thing simply by using SELECT for the query fields I need to display the performance is fine, but the entire form becomes un-editable.
Any ideas on how to accomplish this more efficiently would be greatly appreciated. I've linked pictures of the the form, the form design page, the query design pages, and I've pasted the relevant SQL below.
Form Example Form Design Example
ITNQuery SQL: ITNQuery
SELECT itn.id,
itn.itnnumber,
itn.portfolio,
itn.topic,
itn.itndate,
itn.statusid,
itn.notes,
itn.delivereddate,
itn.leadlinguistid,
itn.teamid AS Expr1,
itn.newversionentry,
itn.previousitn,
itn.reviewinglinguistid,
itn.itnresponse,
itn.leadresponsecoordinatorid,
itn.datesenttoleadcoordinator,
itn.responsedeadline,
itn.priority,
itn.casemanagerid,
itn.responsecoordinator2id,
itn.datesenttocoordinator2,
itn.responsecoordinator3id,
itn.datesenttocoordinator3,
itn.responsecoordinator4id,
itn.datesenttocoordinator4,
itn.coordinatinglinguistid,
Iif([itn].[statusid] <> 9
AND [itn].[statusid] <> 10
AND [itn].[statusid] <> 19
AND [itn].[statusid] <> 20
AND [itn].[statusid] <> 28
AND [itn].[statusid] <> 30, Iif([itn].[delivereddate] > 0,
Datediff("d", [itn].[itndate], [itn].[delivereddate]),
Datediff("d", [itn].[itndate], Now()))) AS ITNAge,
itn.newversionentry,
itn.teamid,
statuslist.[display order],
itn.cooraspondanceid,
itn.documenttypeid,
Dlookup("ducumentabreviation", "associateditntextquery",
"currentitnid =" & [itn].[id]) AS AssocAbrev,
Dlookup("itnnumber", "associateditntextquery",
"currentitnid =" & [itn].[id])
AS AssocNumber
AssociatedITNTextQuery: AssociatedITNTextQuery
SELECT associateditns.current_itn_id AS CurrentITNID,
associateditns.associated_itn_id,
associateddocstextquery1.maxofitndate,
documenttypes.ducumentabreviation,
itn.itnnumber,
itn.itndate
FROM (itn
INNER JOIN documenttypes
ON itn.documenttypeid = documenttypes.id)
INNER JOIN (associateditns
INNER JOIN associateddocstextquery1
ON associateditns.current_itn_id =
associateddocstextquery1.current_itn_id)
ON itn.id = associateditns.associated_itn_id
WHERE ( ( ( itn.itndate ) IN ( associateddocstextquery1 ! maxofitndate ) )
AND
( ( associateddocstextquery1.current_itn_id ) =
associateditns ! current_itn_id ) );
AssociatedITNTextQuery1: AssociatedITNTextQuery1
SELECT associateditns.current_itn_id,
Max(ITN_1.itndate) AS MaxOfITNDate
FROM itn AS ITN_1
INNER JOIN associateditns
ON ITN_1.id = associateditns.associated_itn_id
GROUP BY associateditns.current_itn_id;
Upvotes: 0
Views: 61