S
Sash
I'm executing the following SQL statements on the close of a form. the first
statement seems to take far to long to run. I do have indexes on both
tables. Any other suggestions on making this run faster.
Dim strSQLCPT As String
strSQLCPT = "UPDATE dbo_Anesth INNER JOIN dbo_CPT ON dbo_Anesth.fldProcCPT =
dbo_CPT.[CPT #] SET dbo_Anesth.fldAnesCPT = dbo_CPT.[CPT];"
DoCmd.RunSQL strSQLCPT
Dim strSQLResName As String
strSQLResName = "UPDATE dbo_Anesth INNER JOIN dbo_Resident ON
dbo_Anesth.ip_rescrnanum = dbo_Resident.fldResNum SET dbo_Anesth.ip_rescrna =
dbo_Resident.fldResName;"
DoCmd.RunSQL strSQLResName
Dim strSQLPostop As String
strSQLPostop = "UPDATE dbo_Anesth INNER JOIN dbo_PostOpCPT ON
dbo_Anesth.fldPostOpNum = dbo_PostOpCPT.auto SET dbo_Anesth.fldPostOp =
dbo_PostOpCPT.[PO_CPT];"
DoCmd.RunSQL strSQLPostop
Dim strSQLPostop2 As String
strSQLPostop2 = "UPDATE dbo_Anesth INNER JOIN dbo_PostOpCPT ON
dbo_Anesth.fldPostOpNum2 = dbo_PostOpCPT.auto SET dbo_Anesth.fldPostOp2 =
dbo_PostOpCPT.[PO_CPT];"
DoCmd.RunSQL strSQLPostop2
Dim qryUpdate As String
qryUpdate = "UpdateAdmit"
DoCmd.OpenQuery qryUpdate
Dim qryUpdateRes As String
qryUpdateRes = "Update_ResCRNA"
DoCmd.OpenQuery qryUpdateRes
statement seems to take far to long to run. I do have indexes on both
tables. Any other suggestions on making this run faster.
Dim strSQLCPT As String
strSQLCPT = "UPDATE dbo_Anesth INNER JOIN dbo_CPT ON dbo_Anesth.fldProcCPT =
dbo_CPT.[CPT #] SET dbo_Anesth.fldAnesCPT = dbo_CPT.[CPT];"
DoCmd.RunSQL strSQLCPT
Dim strSQLResName As String
strSQLResName = "UPDATE dbo_Anesth INNER JOIN dbo_Resident ON
dbo_Anesth.ip_rescrnanum = dbo_Resident.fldResNum SET dbo_Anesth.ip_rescrna =
dbo_Resident.fldResName;"
DoCmd.RunSQL strSQLResName
Dim strSQLPostop As String
strSQLPostop = "UPDATE dbo_Anesth INNER JOIN dbo_PostOpCPT ON
dbo_Anesth.fldPostOpNum = dbo_PostOpCPT.auto SET dbo_Anesth.fldPostOp =
dbo_PostOpCPT.[PO_CPT];"
DoCmd.RunSQL strSQLPostop
Dim strSQLPostop2 As String
strSQLPostop2 = "UPDATE dbo_Anesth INNER JOIN dbo_PostOpCPT ON
dbo_Anesth.fldPostOpNum2 = dbo_PostOpCPT.auto SET dbo_Anesth.fldPostOp2 =
dbo_PostOpCPT.[PO_CPT];"
DoCmd.RunSQL strSQLPostop2
Dim qryUpdate As String
qryUpdate = "UpdateAdmit"
DoCmd.OpenQuery qryUpdate
Dim qryUpdateRes As String
qryUpdateRes = "Update_ResCRNA"
DoCmd.OpenQuery qryUpdateRes