Hi All,
I have write a coding and it makes the program super slow.
Anyone can help me to reduce the coding ?
It basically to retrieve the data from table. But with coding below, it makes it slow, when i click back button, it needs to take about 10seconds.
Code:
Private Sub bthback_Click()
DoCmd.OpenForm ("F2CAPAForm")
Forms!F2CAPAform!txtscar = Forms!F3Implementationform!txtscar
Forms!F2CAPAform!txtscar.Enabled = False
Forms!F2CAPAform!txtCA = DLookup("Containment_Action", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtCA.Enabled = False
Forms!F2CAPAform!txtcad = DLookup("CA_Date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtcad.Enabled = False
Forms!F2CAPAform!txtrc = DLookup("Root_Cause", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtrc.Enabled = False
Forms!F2CAPAform!txtCAN = DLookup("Corrective_Action", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtCAN.Enabled = False
Forms!F2CAPAform!txtcand = DLookup("CAN_Date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtcand.Enabled = False
Forms!F2CAPAform!txtPA = DLookup("Preventive_Action", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtPA.Enabled = False
Forms!F2CAPAform!txtpad = DLookup("PA_Date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtpad.Enabled = False
Forms!F2CAPAform!txtresp = DLookup("Responder", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtresp.Enabled = False
Forms!F2CAPAform!txtresppd.Enabled = False
Forms!F2CAPAform!txtrespdate = DLookup("Responder_date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtrespdate.Enabled = False
Forms!F2CAPAform!txtrev = DLookup("Reviewer", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtrev.Enabled = False
Forms!F2CAPAform!txtrevpd.Enabled = False
Forms!F2CAPAform!txtrevdate = DLookup("Reviewer_Date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtrevdate.Enabled = False
Forms!F2CAPAform!txtqm = DLookup("WPPL_QM", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtqm.Enabled = False
Forms!F2CAPAform!txtqmpd.Enabled = False
Forms!F2CAPAform!txtqmdate = DLookup("QM_Date", "F2CAPAtbl", "SCAR = Forms!F2CAPAForm!txtscar")
Forms!F2CAPAform!txtqmdate.Enabled = False
Forms!F2CAPAform!btnsubmit.Enabled = False
Forms!F2CAPAform!btnrwappr.Enabled = False
Forms!F2CAPAform!btnrevrej.Enabled = False
Forms!F2CAPAform!btnqmapp.Enabled = False
Forms!F2CAPAform!btnqmrej.Enabled = False
DoCmd.Close acForm, "F3Implementationform"
End Sub
Thank You