Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Auto fill fields based on combo box selection

31 views
Skip to first unread message

Piperlynne

unread,
May 12, 2009, 12:48:05 PM5/12/09
to
I need help with having a form display the values in certain fields from a
table based on a combo box.
I have a form based on tblProject.
On the form, I have a combo box that looks at the Brand Name field in
tblBrand to find values for user to select to populate the Brand Name in the
tblProject. The combobox is named cboBrand.

In tblBrand - there are 3 fields - UnitType, MasterType, DateCoding that I
want to display when the user selects a Brand Name.
I have tried using cboBrand.Column(1) etc, but I'm pretty sure I'm missing
something.


Arvin Meyer MVP

unread,
May 12, 2009, 1:23:36 PM5/12/09
to
The column index is zero (0) based. The 3 field must be included in the
combo box, even if you didn't want to see them, so typically you'd have the
following fields in the combo with their widths set like:

BrandID 0"
BrandName 1.5"
UnitType 0"
MasterType 0"
DateCoding 0"

your column count would be 5

To refer to UnitType, your code in the AfterUpdate event of the combo would
look like:

Me.txtWhatever = Me.cboBrand(2)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Piperlynne" <Piper...@discussions.microsoft.com> wrote in message
news:9F4F3390-F1D0-44CF...@microsoft.com...

Chegu Tom

unread,
May 12, 2009, 2:58:40 PM5/12/09
to
Also be sure that your combobox recordsource query has all the fields you
need


"Arvin Meyer MVP" <arv...@mvps.invalid> wrote in message
news:uAxQjZy0...@TK2MSFTNGP03.phx.gbl...

Piperlynne

unread,
May 13, 2009, 12:00:06 PM5/13/09
to
Great, thanks!
One question.
In the after update piece, would I repeat that string for each textbox I
want filled in?
I can get the first box (Unit) to work right now, but I can't get the others
to fill in.

Arvin Meyer MVP

unread,
May 13, 2009, 10:56:09 PM5/13/09
to
Yes. If they are in the order below, Master would look like:

Me.MasterType = Me.cboBrand(3)

and DateCoding:

Me.DateCoding = Me.cboBrand(4)


"Piperlynne" <Piper...@discussions.microsoft.com> wrote in message

news:AAD160B1-3114-4084...@microsoft.com...

0 new messages