Making a subform act like a list-box

D

Doug

I am using Access 2007. I have a form I'm trying to code for a local church
camp to assign campers to cabins. There are 2 lists - 1 displays unassigned
campers and the other displays campers assigned to the current cabin (current
record on main form). There are 2 buttons in the middle for 'assign' and
'remove' to move the campers in or out of the current cabin. It worked fine
when I used 2 list-boxes, however there is a new requirement to use
conditional formatting so it is easy to see who the campers are as opposed to
staff. After a bit of research, I discovered you can't do conditional
formatting on a list-box so I'm trying to create 2 subforms that act exactly
like a list-box to the end-user.

Any advice/tips on how to do this correctly?

I've been playing around with it and am not totally pleased with my results.
I've done the following:
1) add a yes/no field called 'Selected' to my campers table to remember if
the camper has been selected or not.
2) created an event on current_record to update 'Selected' field in camper
table to 'False' so that all records always start out false.
3) created a continuous form with the check-box (not exactly like a
list-box) and text box displaying the camper's name.
4) created an event that checks the selected box if you click on the
camper's name (or anywhere in the detail part of the form) and it is
unchecked, or does the reverse if it is checked.

The most annoying thing is that the text box which contains the camper's
name keeps loosing the properties: enabled=false and locked=true. Therefore,
if I click anywhere in the detail portion of the subform, the name disappears
from the current record and I get a blinking cursor in the middle of the text
box (though I'm not able to type or change the camper name). If I can solve
this problem - it's at least a start, but I was curious if anybody had a more
sweeping overview about how to make a subform act like a list-box. Thanks in
advance for your help!
 
D

Doug

Woops! The event I created in #2 above was on form_load on the main form not
current_record. Sorry!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top