Requery of a single row in a subform

L

Loris

Hi all,
in a subform I created I want the list of the possible values in a combobox
(Account_ID) to be updated depending on the value selected in another
combobox (Account_Type).
The main problem I am having is that the value is updated in all the rows of
the subform, while I want to update only the current row.

How to do so?

I am using a code like this:

Private Sub Account_Type_AfterUpdate()
Dim strSQL As String
strSQL = "Select Account_Description,Account_ID from Account where
Account_Type='"
strSQL = strSQL & Me!Account_Type.Column(1) & "' order by
Account_Description"
Me!Account_ID.RowSourceType = "Table/Query"
Me!Account_ID.RowSource = strSQL
Me!Account_ID.Requery
End Sub

Thanks in advance.
 
W

Wolfgang Kais

Hello Loris.

Loris said:
in a subform I created I want the list of the possible values in a
combobox (Account_ID) to be updated depending on the value selected
in another combobox (Account_Type).
The main problem I am having is that the value is updated in all the
rows of the subform, while I want to update only the current row.

How to do so?

Not at all, because if you change an "unbound property" (other than
the value) of a control in a continuous form, this affects "the control"
whitch is the same in all rows of the form.
I am using a code like this:

Private Sub Account_Type_AfterUpdate()
Dim strSQL As String
strSQL = "Select Account_Description,Account_ID from Account where
Account_Type='"
strSQL = strSQL & Me!Account_Type.Column(1) & "' order by
Account_Description"
Me!Account_ID.RowSourceType = "Table/Query"
Me!Account_ID.RowSource = strSQL
Me!Account_ID.Requery
End Sub

You could try to change the RowSource of the second combo also every
time the user moves to another record, that is in the "current" event of
the subform.
 
Top