Hello Gurus,
I have a query regarding the combobox_change event.
I use a combobox which is initialized with data from the DB. The same combo box has a _change event which is being triggered even when I try to pre-load the data from database.
Combobox code when the form is initiated.
frm_MatDev.cmb_Q6 = rst_MATDev.Fields("RslAudit")
frm_MatDev.lbl_ResDate_Q6 = rst_MATDev.Fields("RslAudit_Confirm_Date")
This updates the combobox with the text from RslAudit field and also updates the label beside it with the "Audit Date."
Combobox _change event code.
Private Sub cmb_Q6_Change()
Dim Audit_Date As Date
If frm_MatDev.cmb_Q6 = "Yes" Then
frm_MatDev.lbl_ResDate_Q6 = Format(Now(), "dd/mm/yyyy")
frm_MatDev.lbl_MatDev_Msg = Format(Now(), "dd/mm/yyyy") & ": " & "Deviation resolved with Audit Team."
frm_MatDev.cmd_MatDev_Submit.SetFocus
ElseIf frm_MatDev.cmb_Q6 = "No" Then
frm_MatDev.lbl_ResDate_Q6 = Format(Now(), "dd/mm/yyyy")
frm_MatDev.cmd_MatDev_Submit.SetFocus
ElseIf frm_MatDev.cmb_Q6 = "Audit Confirmed" Then
Audit_Date = Format(InputBox("Confirmed Audit Date in dd/mm/yyyy format", "Confirmed Date"), "dd/mm/yyyy")
frm_MatDev.lbl_ResDate_Q6 = Audit_Date
frm_MatDev.cmd_MatDev_Submit.SetFocus
Else: frm_MatDev.lbl_ResDate_Q6 = ""
'OK
End If
End Sub
I also have the above code that is triggered when the Audit combobox is changed. When it is selected as "Audit Confirmed", it asks for "Audit Date." (which is supposed to be pre-filled from database first time).
How can I overcome this?
Regards,
Ravi.
Bookmarks