Hi Guys,
Is me again. Any method to reduce the dlookup coding?
I know is stupid not using bound form. But i've tried many times, it keeps failed and I don't know how to use bound form.
So, no choice, i need to use the stupid method that is "Coding".
The problem i'm facing with bound form is, when i add new data, i'm not sure why the previous data will at the new form.
Besides that, with using bound form, we need to ensure not everything we input will go into table and we need to use "Before update function" to prevent it to be input into the table.
But i have unique number need to input into new form, with the "Before update function" it keeps not showing my unique number. That's the reason i dont use bound form.
Back to my objective, dlookup will basically slow down my program and i aware of this. Any method to reduce this? Thx in advance.
Code:
Sub Load_CAPA()
DoCmd.OpenForm "F2CAPAform"
Forms!F2CAPAForm!txtscar = Forms!List!List2.Column(1)
Forms!F2CAPAForm!txtscar.Enabled = False
Forms!F2CAPAForm!txtscar = Forms!List!List2.Column(1)
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