Dirty, Change, Click or what?

P

Pendragon

Access03/WinXP

My main form has two subforms. Subform1 lists rooms and times and each
record has five individuals (monitors) to work the room. Subform2 allows the
user to assign or remove each of the five individuals. Subform 2 has five
combo boxes: Monitor1, Monitor2, etc., and command buttons to assign or
remove.

As the user clicks in Subform1 on a different record, I would like Subform2
to autofill the five combo boxes with the individuals currently assigned. I
have the code to autofill working in the main form's OnLoad property. For
Subform1, though, I've tried placing the code in the OnDirty, OnChange and
OnClick and it doesn't work. Where should this go, or what should I be doing?

The recordset for Subform1 has RoomID as primary key. On the main form, I
do have a text box referencing the RoomID and it does successfully change to
the correct value when the user clicks on a different record in Subform1.
Should I be using this as a source for the code?

Thanks for any suggestions!
 
D

Dirk Goldgar

Pendragon said:
Access03/WinXP

My main form has two subforms. Subform1 lists rooms and times and each
record has five individuals (monitors) to work the room. Subform2 allows
the
user to assign or remove each of the five individuals. Subform 2 has five
combo boxes: Monitor1, Monitor2, etc., and command buttons to assign or
remove.

As the user clicks in Subform1 on a different record, I would like
Subform2
to autofill the five combo boxes with the individuals currently assigned.
I
have the code to autofill working in the main form's OnLoad property. For
Subform1, though, I've tried placing the code in the OnDirty, OnChange and
OnClick and it doesn't work. Where should this go, or what should I be
doing?

It sounds to me as though you should be using the Current event of Subform1.
That's the event that fires every time a new record becomes current on the
form. I imagine that your code works in main form's Load event because that
fires after the Load events of the two subforms. However, it's really the
Current event of Subform1 that is logically meaningful for this purpose,
since loading the corresponding record for Subform2 is something you want to
do whenever a user clicks on a different record of Subform1.

Are your two subform's linked in any way, so that Subform2 automatically
shows the assignments for the current record of Subform1? Or are you doing
it all with code? I think we're missing many of the details of how you have
this set up, but it may be that you are doing more work in code than you
need to.
 

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