How to programmatically build full reference to a control

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

Howdy.

The db I'm working on has lots of lookup tables. I want to provide the user
with a way to add/edit/delete values from the lookup tables via associated
forms that are accessible by double-clicking the relevant combo box on a data
entry form.

Here's the process I'm using:

- User double-clicks the combo box that needs values edited
- The currently active form is minimized
- A form opens displaying the values in the lookup table, which can be edited
- When the lookup values form is closed, the 'calling' form is resized, and
the combo box that was double-clicked is requeried

Further, any one lookup table may have associated combo boxes on more than
one form/subform.

Here's what I would like to do:

When the combo box is double-clicked, I would like to save the full
reference to that control - for instance,
Forms![TopLevelForm]![Subform1].Form![Subform1_ComboBox]

Then, when the lookup values form is closed, I can resize the original
('calling') form, and requery the combo box control.

I would like to be able to build that full reference at runtime, so that I
don't have to hard-code the form names and control references. Is there a way
to do that????

Whew... Thanks for the help.

Danny
 
Danny, take a look at this article:
Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html

It explains 4 ways to do this. Option 2 sounds like what you are trying to
do. There's a really easy way to do this in Access 2007, and sample code so
you can double-click the combo in any version to pop up a form to add more
records.

The popup form's Form_AfterUpdate event requeries the combo. You can modify
this code to work with subforms also.
 
Allen, thanks for your reply.

The 2007 combo box control property "List Items Edit Form" does exactly what
I needed.

Allen Browne said:
Danny, take a look at this article:
Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html

It explains 4 ways to do this. Option 2 sounds like what you are trying to
do. There's a really easy way to do this in Access 2007, and sample code so
you can double-click the combo in any version to pop up a form to add more
records.

The popup form's Form_AfterUpdate event requeries the combo. You can modify
this code to work with subforms also.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


Danny said:
Howdy.

The db I'm working on has lots of lookup tables. I want to provide the
user
with a way to add/edit/delete values from the lookup tables via associated
forms that are accessible by double-clicking the relevant combo box on a
data
entry form.

Here's the process I'm using:

- User double-clicks the combo box that needs values edited
- The currently active form is minimized
- A form opens displaying the values in the lookup table, which can be
edited
- When the lookup values form is closed, the 'calling' form is resized,
and
the combo box that was double-clicked is requeried

Further, any one lookup table may have associated combo boxes on more than
one form/subform.

Here's what I would like to do:

When the combo box is double-clicked, I would like to save the full
reference to that control - for instance,
Forms![TopLevelForm]![Subform1].Form![Subform1_ComboBox]

Then, when the lookup values form is closed, I can resize the original
('calling') form, and requery the combo box control.

I would like to be able to build that full reference at runtime, so that I
don't have to hard-code the form names and control references. Is there a
way
to do that????

Whew... Thanks for the help.

Danny

.
 
Back
Top