J
Jack Sheet
Hi all, Access 97
Nearly there.
I now have two tables T_Clients and T_Tasks containing autonumber primary
keys ID_Clients and ID_Tasks.
ID_Clients is duplicated in T_Tasks (Long Integer) with a one-to-many
relationship.
I have created forms F_Tasks and F_Tasks_Sub
F_Tasks collects data from T_Clients
F_Tasks_sub collects data from T_Tasks and is a subform within F_Tasks.
In F_Tasks I include a combo box to select clients as an alternative to the
navigation bar. This works fine.
In F_Tasks_Sub I include a combo box to select tasks as an alternative to
the navigation bar. This does not work, because the drop-down box does NOT
limit the selection to just those tasks for which ID_Clients matches the
selection in the parent form.
The code behind the (failing) combo box within the sub form is
Option Compare Database
Option Explicit
Private Sub Form_Current()
Combo72 = Null
End Sub
Sub Combo72_AfterUpdate()
' Find the record that matches the control.
If Len(Me![Combo72] & "") > 0 Then
Me.RecordsetClone.FindFirst "[ID_Tasks] = " & Me![Combo72]
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
This is identical to the code behind the combo box in the parent form except
that the combo box number is different and for ID_Tasks it says ID_Clients.
SO: How do I get the drop-down list in the combo box in teh subform to limit
the available options only to those records within T_Tasks for which the
ID_Clients field matches the selection in the parent form?
Currently the RowSource property is set to:
SELECT DISTINCTROW [T_Tasks].[ID_Tasks], [T_Tasks].[Task], [T_Tasks].[End]
FROM [T_Tasks];
and Limit to List is set to Yes
Thanks
Nearly there.
I now have two tables T_Clients and T_Tasks containing autonumber primary
keys ID_Clients and ID_Tasks.
ID_Clients is duplicated in T_Tasks (Long Integer) with a one-to-many
relationship.
I have created forms F_Tasks and F_Tasks_Sub
F_Tasks collects data from T_Clients
F_Tasks_sub collects data from T_Tasks and is a subform within F_Tasks.
In F_Tasks I include a combo box to select clients as an alternative to the
navigation bar. This works fine.
In F_Tasks_Sub I include a combo box to select tasks as an alternative to
the navigation bar. This does not work, because the drop-down box does NOT
limit the selection to just those tasks for which ID_Clients matches the
selection in the parent form.
The code behind the (failing) combo box within the sub form is
Option Compare Database
Option Explicit
Private Sub Form_Current()
Combo72 = Null
End Sub
Sub Combo72_AfterUpdate()
' Find the record that matches the control.
If Len(Me![Combo72] & "") > 0 Then
Me.RecordsetClone.FindFirst "[ID_Tasks] = " & Me![Combo72]
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
This is identical to the code behind the combo box in the parent form except
that the combo box number is different and for ID_Tasks it says ID_Clients.
SO: How do I get the drop-down list in the combo box in teh subform to limit
the available options only to those records within T_Tasks for which the
ID_Clients field matches the selection in the parent form?
Currently the RowSource property is set to:
SELECT DISTINCTROW [T_Tasks].[ID_Tasks], [T_Tasks].[Task], [T_Tasks].[End]
FROM [T_Tasks];
and Limit to List is set to Yes
Thanks