multiple combo boxes from same table

  • Thread starter Thread starter Han
  • Start date Start date
H

Han

I have a form that contains four combo boxes, which get their values from
the same table. Visibility is set to FALSE by default. The number of records
returned will determine how many combo boxes are shown (Visibility = TRUE).

I have two tables. The first is read-only and contains a list of activities:

ActivityID = 1, ActivityType = "Sailing"
ActivityID = 2, ActivityType = "Bowling"
ActivityID = 3, ActivityType = "Skating"

The second table contains the user's choices:

DayID = 1, ActivityID=1
DayID = 1, ActivityID=2
DayID = 1, ActivityID=3
DayID = 2, ActivityID=1
DayID = 2, ActivityID=2
DayID = 3, ActivityID=2

Let's say my query looks like this:

SELECT Activities.ActivityType FROM Choices, Activities WHERE
Choices.DayID=1

This would return 3 records.

As a result, I need to accomplish the following:

1) make visible 3 combo boxes filled with values
2) set the value to the current choice
3) save any selection changes

#1 is easy, but 2 and 3 have me stumped. If the Control Source is set to
"ActivityID", all three combo boxes are referring to the first record.

Any help would be greatly appreciated.

Thanks,
Han
 
Han,

IMHO this is an unnecessarily difficult and complicated way of going
about this. You should only have one combobox, and you should be
using a continuous view form to show the multiple records. The form
should be based on the Choices table, the combobox bound to the
ActivityID field, the combobox's RowSource set to the Activities
table, and the combobox's BoundColumn, ColumnWidths, and ColumnCount
properties set such that the ActivityType is the displayed data.

By the way, the query you gave is incorrect for your purpose anyway,
and it will return 9 records not 3.

Please post back if you need more detailed help with this.

- Steve Schapel, Microsoft Access MVP
 
Steve, you are the man!

The continuous form works great! I'm not hip to all the cool built-in stuff.
Agreed, my method is much more complicated, but my conventional programmer
wisdom tells me to code everything by hand. :-]

The only thing missing now is a way to delete a combo box (and the
corresponding record). I suppose adding a command button next to each box
will do the trick (?) Any advice is appreciated and welcome.

Thanks very much,
Han
 
Yes, Han, a little command button in the detail section of the form,
which will then show on each record, will be ok for this. You can
code its Click event...
DoCmd.RunCommand acCmdDeleteRecord

- Steve Schapel, Microsoft Access MVP
 
Steve, thanks again.

I added a msgbox for confirmation--work great.

Regards,
Han

Steve Schapel said:
Yes, Han, a little command button in the detail section of the form,
which will then show on each record, will be ok for this. You can
code its Click event...
DoCmd.RunCommand acCmdDeleteRecord

- Steve Schapel, Microsoft Access MVP


Steve, you are the man!

The continuous form works great! I'm not hip to all the cool built-in stuff.
Agreed, my method is much more complicated, but my conventional programmer
wisdom tells me to code everything by hand. :-]

The only thing missing now is a way to delete a combo box (and the
corresponding record). I suppose adding a command button next to each box
will do the trick (?) Any advice is appreciated and welcome.

Thanks very much,
Han
 
Back
Top