PC Review


Reply
Thread Tools Rate Thread

Automatically Fill a Text or List Box Based on a Combo Box Selecti

 
 
=?Utf-8?B?TWF0dA==?=
Guest
Posts: n/a
 
      21st Jun 2006
I have a client management database. Each client has a name and an ID
number. On my forms, there is a combo box with a drop down list of all
clients. When a user selects a client, I need that client's ID number to
automatically "come up" in the client ID number field on the form. Currently
that ID number field is is a text field, though I've tried accomplishing this
by making it either a list or a combo box connected to a query. So far I
haven't been successful.

I'm using MS Access 2003 on Windows XP.

Thanks for any ideas!

Matt
 
Reply With Quote
 
 
 
 
Al Camp
Guest
Posts: n/a
 
      21st Jun 2006
Matt,
Use your own object names...
Create a 2 column combo. First column = CustID Second = CustName
No of Columns = 2
ColWidths = 0"; 1.5" '(hide the first column)
ListWidth = 1.5

Bind the CustID field to the ControlSource of the Combo.

What this combo does is display the customer names for easy user selection.
Once a customer name has been selected , the combo will "display" that name in the
combo.
BUT what's really stored in the bound CustID combo field is the CustID from the 1st
"hidden" column.
The form may show "Smith", but the table has stored the CustID 5241 in that CustID
field.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"Matt" <(E-Mail Removed)> wrote in message
news:5F80B007-42BF-4E2C-8FE9-(E-Mail Removed)...
>I have a client management database. Each client has a name and an ID
> number. On my forms, there is a combo box with a drop down list of all
> clients. When a user selects a client, I need that client's ID number to
> automatically "come up" in the client ID number field on the form. Currently
> that ID number field is is a text field, though I've tried accomplishing this
> by making it either a list or a combo box connected to a query. So far I
> haven't been successful.
>
> I'm using MS Access 2003 on Windows XP.
>
> Thanks for any ideas!
>
> Matt



 
Reply With Quote
 
=?Utf-8?B?TWF0dA==?=
Guest
Posts: n/a
 
      21st Jun 2006
That's awesome. However, I also need to save CustName to the table to which
that form is saving data. I've tried doing this with a macro which has the
action SetValue, setting the value of CustName in the table to the combo box,
but that doesn't work. Any thoughts? Thanks!

"Al Camp" wrote:

> Matt,
> Use your own object names...
> Create a 2 column combo. First column = CustID Second = CustName
> No of Columns = 2
> ColWidths = 0"; 1.5" '(hide the first column)
> ListWidth = 1.5
>
> Bind the CustID field to the ControlSource of the Combo.
>
> What this combo does is display the customer names for easy user selection.
> Once a customer name has been selected , the combo will "display" that name in the
> combo.
> BUT what's really stored in the bound CustID combo field is the CustID from the 1st
> "hidden" column.
> The form may show "Smith", but the table has stored the CustID 5241 in that CustID
> field.
> --
> hth
> Al Camp
> Candia Computer Consulting - Candia NH
> http://home.comcast.net/~cccsolutions
>
>
> "Matt" <(E-Mail Removed)> wrote in message
> news:5F80B007-42BF-4E2C-8FE9-(E-Mail Removed)...
> >I have a client management database. Each client has a name and an ID
> > number. On my forms, there is a combo box with a drop down list of all
> > clients. When a user selects a client, I need that client's ID number to
> > automatically "come up" in the client ID number field on the form. Currently
> > that ID number field is is a text field, though I've tried accomplishing this
> > by making it either a list or a combo box connected to a query. So far I
> > haven't been successful.
> >
> > I'm using MS Access 2003 on Windows XP.
> >
> > Thanks for any ideas!
> >
> > Matt

>
>
>

 
Reply With Quote
 
Al Camp
Guest
Posts: n/a
 
      21st Jun 2006
Matt,
Since you've captured the CustID, there's no need to "capture" the CustName. The
CustName can always be re-derived from the Customer table in any future form, query, or
report. Don't carry information in fields that can be re-derived again at any time "on
the fly."

If you "must" save CustName, add a CustName field to the table you're updating with
this form, bind it to a text control, and on the AfterUpdate event of the CustID combo....
(we'll call that cboCustID)

CustName = cboCustID.Column(1)

(columns in combos are numbered 0, 1, 2, 3, etc..)
CustID is in 0, CustName is in 1.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


"Matt" <(E-Mail Removed)> wrote in message
news:0C21A00E-E41E-4BB7-B3A2-(E-Mail Removed)...
> That's awesome. However, I also need to save CustName to the table to which
> that form is saving data. I've tried doing this with a macro which has the
> action SetValue, setting the value of CustName in the table to the combo box,
> but that doesn't work. Any thoughts? Thanks!
>
> "Al Camp" wrote:
>
>> Matt,
>> Use your own object names...
>> Create a 2 column combo. First column = CustID Second = CustName
>> No of Columns = 2
>> ColWidths = 0"; 1.5" '(hide the first column)
>> ListWidth = 1.5
>>
>> Bind the CustID field to the ControlSource of the Combo.
>>
>> What this combo does is display the customer names for easy user selection.
>> Once a customer name has been selected , the combo will "display" that name in the
>> combo.
>> BUT what's really stored in the bound CustID combo field is the CustID from the 1st
>> "hidden" column.
>> The form may show "Smith", but the table has stored the CustID 5241 in that CustID
>> field.
>> --
>> hth
>> Al Camp
>> Candia Computer Consulting - Candia NH
>> http://home.comcast.net/~cccsolutions
>>
>>
>> "Matt" <(E-Mail Removed)> wrote in message
>> news:5F80B007-42BF-4E2C-8FE9-(E-Mail Removed)...
>> >I have a client management database. Each client has a name and an ID
>> > number. On my forms, there is a combo box with a drop down list of all
>> > clients. When a user selects a client, I need that client's ID number to
>> > automatically "come up" in the client ID number field on the form. Currently
>> > that ID number field is is a text field, though I've tried accomplishing this
>> > by making it either a list or a combo box connected to a query. So far I
>> > haven't been successful.
>> >
>> > I'm using MS Access 2003 on Windows XP.
>> >
>> > Thanks for any ideas!
>> >
>> > Matt

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make a form update textboxes based on a combo box selecti BTU_needs_assistance_43 Microsoft Access VBA Modules 0 15th Jul 2009 09:01 PM
Make Combo Box appear/disappear based on another combo box selecti =?Utf-8?B?ZHVrZXR0ZXI=?= Microsoft Access 4 8th Mar 2007 08:07 PM
RE: Make Combo Box appear/disappear based on another combo box selecti =?Utf-8?B?ZHVrZXR0ZXI=?= Microsoft Access 0 8th Mar 2007 07:24 PM
How do I make a text box value appear based on a combo box selecti =?Utf-8?B?Q3JhaWc=?= Microsoft Access Getting Started 1 15th May 2005 05:48 PM
Automatically fill the fields on a form based on COMBO'S VALUE lin Microsoft Access Getting Started 1 16th Aug 2004 11:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:13 PM.