Hello Guys,
I am a newbie to Ms access. I am having a problem with a modified Order Details form from Northwind 2007.
This form has a main form (Order Details) that has a Beneficiary ID combobox. It also has a subform with the fields ITEM, QUANTITY, PRICE, DISCOUNT SUBTOTAL AND BENEFIT ID (Combobox)
Each Beneficiary has one or more benefits that they have selected beforehand and all transaction items will be assigned to one of the selected benefits.
When I first open the Order Details form and choose a beneficiary from the CUSTOMER ID Combobox on the main form, the correct benefits that were selected for that person are shown in the subform in the BENEFIT ID Combobox.
If I should choose another beneficiary the correct information is also displayed. IF I SHOULD CLICK IN THE DATASHEET ON THE SUB FORM AND THEN CLICK BACK ON THE CUSTOMER ID FIELD ON THE MAIN FORM AND CHANGE THE BENEFICIARY,
then the benefits selected in the Benefit ID combobox of the subform do not change.
The benefits displayed in the combobox of the subform should be requeried each time a different beneficiary is chosen of the main form. I have tried the following code and various other things but with no success. I suspect that I may not be using the correct form events.
I have attached a TEST DB.
Username: Test Employee
Password: Test
VBA Password: rocky123
Just log in and choose the New Transactions button on the home page. Please let me know what I am doing wrong.
MAIN FORM - Customer ID afterupdate event
Private Sub Customer_ID_AfterUpdate()
Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID]= NULL
Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].Requery
Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID]= Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].ItemData(0)
End Sub
MAIN FORM - Form Current Event
Private Sub Form_Current()
Forms![Order Details]![sbfOrderDetails].Form![BENEFIT ID].Requery
End Sub