Looking for some help running queries based on a combo box. Have looked through the forums and couldn't find anything on running different queries based on values.
I need to allow the user to switch back and forth between two different recipients of documents that are to be printed and mailed. To do this, I created one table that will store the information for the recipient which will be printed as an address. I have a form called F_MailRequest with a combo box (Combo60) that the user can select one of 2 different recipient types from . I need to be able to run one of two different update queries based on the value of the combobox. The values in the box are from a table called tbl_shipselections. There are two columns in the combo box and the bound column is #1. Values are 1 Owner, 2 LH. When the value of the combo box is ID 1 "Owner" I want to run a query called qry_UPD_MReq_RecipientShip (Yes I know that is a long name). When the value of the combo box is ID 2 "LH" I want to run a query called qry_UPD_MReq_LH.
In the AfterUpdate for the combo box I have the following code.
Private Sub Combo60_AfterUpdate()
Select Case Me.Combo60.Column(1)
Case 1
DoCmd.OpenQuery "qry_UPD_MReq_ReceipientShip"
Case 2
DoCmd.OpenQuery "qry_UPD_MReq_LHShip"
End Select
Form_F_MailRequest.Requery
End Sub
I don't get any errors, but the update queries won't run. Any help would be greatly appreciated.
I need to allow the user to switch back and forth between two different recipients of documents that are to be printed and mailed. To do this, I created one table that will store the information for the recipient which will be printed as an address. I have a form called F_MailRequest with a combo box (Combo60) that the user can select one of 2 different recipient types from . I need to be able to run one of two different update queries based on the value of the combobox. The values in the box are from a table called tbl_shipselections. There are two columns in the combo box and the bound column is #1. Values are 1 Owner, 2 LH. When the value of the combo box is ID 1 "Owner" I want to run a query called qry_UPD_MReq_RecipientShip (Yes I know that is a long name). When the value of the combo box is ID 2 "LH" I want to run a query called qry_UPD_MReq_LH.
In the AfterUpdate for the combo box I have the following code.
Private Sub Combo60_AfterUpdate()
Select Case Me.Combo60.Column(1)
Case 1
DoCmd.OpenQuery "qry_UPD_MReq_ReceipientShip"
Case 2
DoCmd.OpenQuery "qry_UPD_MReq_LHShip"
End Select
Form_F_MailRequest.Requery
End Sub
I don't get any errors, but the update queries won't run. Any help would be greatly appreciated.