Hi everyone
I am trying to make search form with combo box selection i did good to have it ready for use but one problem.
I have five combo boxes on search form with different field names, all i want is when i select one combo box then rest of the combo boxes should go blank and result should show only with selected combo box.
If possible kindly advise the code for above issue.
thanks & regards,
MA
I am trying to make search form with combo box selection i did good to have it ready for use but one problem.
I have five combo boxes on search form with different field names, all i want is when i select one combo box then rest of the combo boxes should go blank and result should show only with selected combo box.
Code:
Option Compare Database
Private Sub cmbContractSearch_ContractID_AfterUpdate()
Dim myContracts As String
myContracts = " Select * from tblEmploymentContracts WHERE ([ContractID] = '" & Me.cmbContractSearch_ContractID & "')"
frmContractsSearch_subform.Form.RecordSource = myContracts
Me.frmContractsSearch_subform.Form.Requery
End Sub
Private Sub cmbContractSearch_ContractStatus_AfterUpdate()
Dim myStatus As String
myStatus = " Select * from tblEmploymentContracts where ([ContractStatus] ='" & Me.cmbContractSearch_ContractStatus & "')"
frmContractsSearch_subform.Form.RecordSource = myStatus
Me.frmContractsSearch_subform.Form.Requery
End Sub
Private Sub cmbContractSearch_EmpID_AfterUpdate()
Dim myemployee As String
myemployee = " Select * from tblEmploymentContracts where ([EmployeeID] ='" & Me.cmbContractSearch_EmpID & "')"
frmContractsSearch_subform.Form.RecordSource = myemployee
Me.frmContractsSearch_subform.Form.Requery
End Sub
Private Sub cmbContractSearch_EmpName_AfterUpdate()
Dim EmployeeName As String
EmployeeName = " Select * from tblEmploymentContracts WHERE ([EmployeeName] = '" & Me.cmbContractSearch_EmpName & "')"
frmContractsSearch_subform.Form.RecordSource = EmployeeName
frmContractsSearch_subform.Form.Requery
End Sub
Private Sub cmbContractSearch_LineManager_AfterUpdate()
Dim myManager As String
myManager = " Select * from tblEmploymentContracts where ([LineManager] ='" & Me.cmbContractSearch_LineManager & "')"
frmContractsSearch_subform.Form.RecordSource = myManager
Me.frmContractsSearch_subform.Form.Requery
End Sub
If possible kindly advise the code for above issue.
thanks & regards,
MA