How to programmatically build full reference to a control

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
 
A

Allen Browne

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.
 
D

Danny

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

.
 

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