Here's the dilemma I've having currently. Right now I have an existing VB project that I didn't build, but I need to add a filter so to the form that it only displays orders in a List Box that have been Canceled or ones that are still Active. I want the user to choose which by a combo box. There are already three combo boxes setup on the form in the same fashion to filter by Name, Department, etc. The problem is the way this form was designed, was that it was built in a such a way that it doesn't use a query from what I can see, and instead does everything via the List Box row source. Here's whats currently in the List Box Row Source.
Code:
SELECT tbl_charter_data_history.Charter_ID, tbl_charter_data_history.Charter_Date, tbl_charter_data_history.Bill_To, Format([Phone_No],"000-000-0000") AS Phone, tbl_charter_data_history.Pick_up_Time, tbl_charter_data_history.Pickup, tbl_charter_data_history.Destination FROM tbl_charter_data_history WHERE (((tbl_charter_data_history.Charter_Date) Between Forms!frm_EditCharter_Select2!cboFromDate And Forms!frm_EditCharter_Select2!cboToDate) And ((tbl_charter_data_history.Bill_To)=IIf(Forms!frm_EditCharter_Select2!cboCustomer Is Not Null,Forms!frm_EditCharter_Select2!cboCustomer,tbl_charter_data_history!Bill_To)) And ((tbl_charter_data_history.Phone_No)=IIf(Forms!frm_EditCharter_Select2!cboPhone Is Not Null,Forms!frm_EditCharter_Select2!cboPhone,[phone_No])) And ((tbl_charter_data_history.Branch_assigned_Charter)=IIf(Forms!frm_EditCharter_Select2!cboBase Is Not Null,Forms!frm_EditCharter_Select2!cboBase,tbl_charter_data_history!Branch_assigned_Charter))) ORDER BY tbl_charter_data_history.Charter_Date DESC;
Here's additional relevant information...
Table name where the fields I want to filter are stored - tbl_charter_data_history
Field Name in Table - Status (CANCELLED or ACTIVE)
List Box Name - List33
Code for the Combo Box in question...
Code:
Private Sub cboCancel_AfterUpdate()Me.Refresh
End Sub
So my question ultimately is, is there an easy way I can insert something into the row source for the List Box or use code to be able to do this without having to change anything else and rebuild the form from scratch?