Update listbox dependent on data in form

Jan van Bekkum

Registered User.
Local time
Today, 21:27
Joined
Feb 25, 2010
Messages
23
I have a table [DecisionMachine] with a master/slave relationship to a second table [DecisionOptions]. I also have a form with [DecisionMachine] as record source. In the form I want to use a listbox that only lists the records in [DecisionOptions] that correspond with the current record of [DecisionMachine]. I have tried to achieve this by using row source

SELECT [DecisionMachineOptionsCurrentDecision].[OptionText], [DecisionMachineOptionsCurrentDecision].[ID] FROM DecisionMachineOptionsCurrentDecision ORDER BY [ID];

However, when I go to a new record. The listbox stays at the first record.

I go to the next record in [DecisionMachine] by means of a button that triggers an embedded macro that has a "GoToRecord" line
 
Check out the Current event of a form, which fires after a change in the current record. This is commonly where you update any user interface elements that depend on the data in the current record, and where you'll want to requery your list. Code might look like ...
Code:
Private Sub Form_Current()
  If Not Me.NewRecord Then Me.MyListCtrl.Requery
End Sub
 

Users who are viewing this thread

Back
Top Bottom