Populating fields via a Record Select Combo

A

Adrian Clarke

Hi All,
I'm sure this has been gone through many times before but, having searched the internet, I am rather lost/confused. Any help would be very much appreciated.

I want to populate a few fields on a form with fields from a chosen record in a table that is NOT the Bound Table of the form. The Combo Box that does the choosing displays the correct list from the Table (Model Numbers) and allows me to choose an entry, it is the afterUpdate bit I can't get.

I've seen a few code pieces in various different answers on the web but none of them seem to specify a table, so presumably operate on the bound table.

(b.t.w. the convert Macros to VBA Option says it has a "problem" and does nothing)

Any help welcome


Submitted via EggHeadCafe - Software Developer Portal of Choice
Composite UI Pattern and RAD Development for Data Entry Applications, Part 1
http://www.eggheadcafe.com/tutorial...pment-for-data-entry-applications-part-1.aspx
 
J

John W. Vinson

Hi All,
I'm sure this has been gone through many times before but, having searched the internet, I am rather lost/confused. Any help would be very much appreciated.

I want to populate a few fields on a form with fields from a chosen record in a table that is NOT the Bound Table of the form. The Combo Box that does the choosing displays the correct list from the Table (Model Numbers) and allows me to choose an entry, it is the afterUpdate bit I can't get.

I've seen a few code pieces in various different answers on the web but none of them seem to specify a table, so presumably operate on the bound table.

(b.t.w. the convert Macros to VBA Option says it has a "problem" and does nothing)

Neither macros nor code should be needed. To just *display* these fields,
include them in the combo box's Row Source query. You can use the combo's
Column Widths property to set those columns' width to 0 so they won't show up
when the combo is dropped down.

You can then put textboxes on the form with Control Source properties like

=comboboxname.Column(n)

where n is the *zero based* index of the field you want to see - that is, if
the Size is the fourth column in the query use (3).

If you're trying to *store* this information in a second table, copied from
the Model Numbers table, well... don't; storing data redundantly is pretty
much always a Bad Thing to Do. If you think you need to do so anyway please
explain.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
D

David W. Fenton

You can then put textboxes on the form with Control Source
properties like

=comboboxname.Column(n)

where n is the *zero based* index of the field you want to see -
that is, if the Size is the fourth column in the query use (3).

Or, you could use a linked subform.
 
A

Adrian Clarke

Yup ! It's as simple as that!
I was as you suggest just displaying the information
OK ...feel pretty Sheepish right now!

Many thanks for your help, I spent hours looking for the answer. I have now used this in 3 or 4 other places in the database.

More questions of a similarly basic nature may follow!


Submitted via EggHeadCafe - Software Developer Portal of Choice
Book Review: Excel 2010 - The Missing Manual [OReilly]
http://www.eggheadcafe.com/tutorial...w-excel-2010--the-missing-manual-oreilly.aspx
 

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