Hello everyone,
Let me describe my form setup first.
I have a main form named "frmMain" with a combo box named "cboCustomer."
In this main form I have a sub form named "subfrmMain" with a combo box named "cboProduct" and a text box named "txtDiscount."
The txtDiscount's value relies on the cboProduct "after update" and "on got focus" event through which I call the value from it's row source query like below.
Code:
Private Sub cboProduct_AfterUpdate()
If Me.Parent!cboCustomerType = "VIP" Then
Me.txtDiscount = Me.cboProduct.Column(3)
Else
Me.txtDiscount = 0
End If
End Sub
Private Sub cboProduct_GotFocus()
If Me.Parent!cboCustomerType = "VIP" Then
Me.txtDiscount = Me.cboProduct.Column(3)
Else
Me.txtDiscount = 0
End If
End Sub
I want to keep the value of the txtDiscount depending on the value of the cboCustomer on the frmMain, sort of like a discount history, but I do want to change it when I change the cboCustomer. This is where I begin to have a problem. After I choose "VIP" from the cboCustomer, the txtDiscount displays the correct amount only for one record if the focus is on the cboProduct of that record.
So If I have more than one record in the subfrmMain, only the row where the cboProduct has focus will the value for the txtDiscount change BUT the succeeding records will not update their txtDiscount value until it's cboProduct has focus. So the long solution for me is to cycle through all the records to trigger the event on the cboProduct control "on got focus."
I have tried to make an event on cboCustomer on the frmMain after update to requery the cboProduct or refresh the subfrmMain, but didn't not work. The txtDiscount value only change when cboProduct gets focus.
I hope I explained my problem well since I'm having trouble explaining it, I have tried to search but did know exactly what to search for.
I would very much like to update every row/record in the subfrmMain to reflect the correct txtDiscount value depending on the cboCustomer value.
Thank you much for your patience.