Combo and textboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a problem thats driving me crazy, hopefully it's easy for some of you
:-)

heres my scenerio:
Combo A - Class
Combo B - Class Section
textbox - Time

When a user selects a class, combo B shows the sections available for that
class and then once the user selects the section, the time for that section
shows up on the textbox. My combos work but when they select a section, it
shows a time for a different class with the same section e.g I have Physics
and chemistry, both with 4 sections, if the user selects Physics, it shows
section 1, 2 etc but when they pick section 1, it shows the time for
Chemistry, Section 1..

My "after update" code for combo B is:

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Course section]= '" & Me![ComboB] & "'"
Me.Bookmark = rs.Bookmark

End Sub

Any advice on how to get this working will be very appreciated.. Thank you.
 
Riza,

I think the problem is that you are working with both the comboboxes'
rowsource data and the form's recordsource. To keep it simple, use just
the combobox data.

In comboB, create a second column that contains the section time.
You'll have to get this from the combobox's underlying query. In
comboB's AfterUpdate, put:

Me.txtTime = Me.ComboB.Columns(1) ' Column 1 is the 2nd column.

You can hide the time column if you want by setting its ColumnWidths
property to 1"; 0".

HTH,
Barry
 
Back
Top