Adjusting control per record, not per form

  • Thread starter Thread starter Kurt Häusler
  • Start date Start date
K

Kurt Häusler

Hi.

I have a subform (this is a very standard order form, with item list
subform) with 2 combo boxes on it.

The first combo box chooses which section I want. For example, Doors,
Roofing, Outdoor, Windows, Indoor, Electrical. This combo box sets the
Row Source for the second combo box.

I do this with this VB code:

Private Sub Combo10_Change()
Me.Combo12.RowSource = "SELECT [Extras].[Extra-Id],
[Extras].[Description] FROM Extras WHERE
[Extras].[Section]=Combo10.Value; "
End Sub

Now combo12 is bound, but when the above code runs, it changes the Row
Source of that combo box for every record! This means that we cant
look back up at already entered records and see the description,
except where the section is the same as the current section.

So, my question is, if Me. refers to the whole form i.e. All records,
how do I refer to specifically the control ONLY on the current record?

Thanks a lot.

Kurt
 
It sounds like you are using ContinuousFormView for the Subform. In this
case, what you see is many instances of the SAME Control (ComboBox) and
since it is ONE Control, you only have ONE RowSource.

There are a few work-arounds to this problem. One way is available from the
Microsoft KB:

http://support.microsoft.com/?id=208866

Another way is to use an extra TextBox (or ComboBox) super-imposed on the
original ComboBox and use code to manipulate the visibility of either your
ComboBox or the super-imposed TextBox /ComboBox.
 
Back
Top