C
Capt. Skinny
I have a ListBox on an Access 2007 form. Using Query Builder, the
RowSource property of the ListBox is set to:
----
SELECT field1, field2
FROM tRelatedData
WHERE tRelatedData.foreign_key=Forms!MyForm!primary_key
----
The problem is that the where clause is not dynamic; it seems that the
expression "Forms!MyForm!primary_key" in the WHERE clause is only set
once when the form is first loaded. For example, if the primary_key
field of the first record to show up in Form view is 17, then for each
record on my form the list box will only display records for which
tRelatedData.foreign_key=17
Should I be handling some event that fires when I navigate between the
records of a form, and updating the WHERE clause of my RowSource
property each time? None of the Form object's events strike me as an
obvious candidate. Thank you in advance. -cs
RowSource property of the ListBox is set to:
----
SELECT field1, field2
FROM tRelatedData
WHERE tRelatedData.foreign_key=Forms!MyForm!primary_key
----
The problem is that the where clause is not dynamic; it seems that the
expression "Forms!MyForm!primary_key" in the WHERE clause is only set
once when the form is first loaded. For example, if the primary_key
field of the first record to show up in Form view is 17, then for each
record on my form the list box will only display records for which
tRelatedData.foreign_key=17
Should I be handling some event that fires when I navigate between the
records of a form, and updating the WHERE clause of my RowSource
property each time? None of the Form object's events strike me as an
obvious candidate. Thank you in advance. -cs