I have a problem with a subform on a mainform.
I have;
Databases amongst which;
tbl_trajecten (including field: ID_traject)
tbl_reasons (including field: ID_reason_traject)
a main form called : frm_traject_detail
a form called : frm_reasons (which is used as a subform on the main form using ID_traject as linking master field and ID_reason_traject as linking child field - this is a continous form because the user can put in multiple reasons)
On the main form i let users put in data of prospects.
On the subform i want users to indicate why a prospect (salesopportunity) is won or lost (can be multiple reasons).
On the subform i have 2 comboboxes;
[cmb_reason_type]
[cmb_reason]
The record source of subform frm_reasons is a table called tbl_reasons
The record source of [cmb_reason_type] is; a query that lists one field from a query from tbl_reasons called [reason_type]
this is an unbound combobox.
The record source of [cmb_reason] is all fields from tbl_reasons
Record source is [Reason] from the tbl_reason (which is a numeric field)
Bound column is 1: [ID_reason] (not visible, because user will see column2 in which the name of the reason is listed.
When I choose an item from [cmb_reasons_type], an afterupdate event makes sure that [cmb_reasons] will list only reasons of a certain type (as indicated in the [cmb_reasons_type] combobox).
In the after_update event of the first combobox [cmb_reason_type] i have the following code;
Expand|Select|Wrap|Line Numbers
- Private Sub cmb_reason_type_AfterUpdate()
- Dim strreden As String
- strreden = "SELECT * FROM Q_reason "
- strreden = strreden & "WHERE [reason_type] = [cmb_reason_type]"
- Me.[cmb_reason].RowSource = strreden
- Me.[cmb_reason].Requery
- End Sub
When the user tries to put select a nuw type of reason from [cmb_reason_type], all previous [cmb_reason_type] comboboxes turn to this new value, which is NOT wat should happen.
How can i make it so that a new entry does not effet previous entries ?
Any help would be greatly appreciated !
Regards,
Pierkes.