PC Review


Reply
Thread Tools Rate Thread

Combo Box Choice Populates Text Boxes

 
 
=?Utf-8?B?UGFwZXJiYWNrIFdyaXRlcg==?=
Guest
Posts: n/a
 
      31st May 2006
I have a combo box that sits on a query. This query zeroes in on one field.
I'd like about five other fields from this query to be populated based on
which value is selected in the combo box.

How do I do this?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      31st May 2006
Hi PW -- Can you clarify a little? Do you mean the query is used to populate
the combo box? Also, what do you mean by the query zeroes in on one field?
Last, the five fields you want automatically populated, are these in a form
or in the query?

"Paperback Writer" wrote:

> I have a combo box that sits on a query. This query zeroes in on one field.
> I'd like about five other fields from this query to be populated based on
> which value is selected in the combo box.
>
> How do I do this?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGFwZXJiYWNrIFdyaXRlcg==?=
Guest
Posts: n/a
 
      31st May 2006
When you set up a Combo Box, it asks if you want it to bring up values from a
query or a table. I selected "query." I then asked it to only return one
field, which is the pivotal field.

The related fields are in the same query. I want those text boxes, all of
which are inside a form, to populate depending on what is selected in the
combo box.


"xRoachx" wrote:

> Hi PW -- Can you clarify a little? Do you mean the query is used to populate
> the combo box? Also, what do you mean by the query zeroes in on one field?
> Last, the five fields you want automatically populated, are these in a form
> or in the query?
>
> "Paperback Writer" wrote:
>
> > I have a combo box that sits on a query. This query zeroes in on one field.
> > I'd like about five other fields from this query to be populated based on
> > which value is selected in the combo box.
> >
> > How do I do this?

 
Reply With Quote
 
Ron2006
Guest
Posts: n/a
 
      31st May 2006
IF
combo box query contains field1, field2 thru 5 in that seqence
if forinstance only bound field shows and it is field 2 then the
bound = 2
number fields = 5
field lengths = 0;1;0;0;0
the above is what you are looking for in general.

Now
in the afterupdate event of the combo box you can retrieve the fields
from that combo entry as follows

me.txttoshow1 = me.comboboxname.column(0)
me.txttoshow2 = me.comboboxname.column(1)
me.txttoshow3 = me.comboboxname.column(2)
me.txttoshow4 = me.comboboxname.column(3)
me.txttoshow5 = me.comboboxname.column(4)

The columns are relative to 0 (not 1)






Paperback Writer wrote:
> When you set up a Combo Box, it asks if you want it to bring up values from a
> query or a table. I selected "query." I then asked it to only return one
> field, which is the pivotal field.
>
> The related fields are in the same query. I want those text boxes, all of
> which are inside a form, to populate depending on what is selected in the
> combo box.
>
>
> "xRoachx" wrote:
>
> > Hi PW -- Can you clarify a little? Do you mean the query is used to populate
> > the combo box? Also, what do you mean by the query zeroes in on one field?
> > Last, the five fields you want automatically populated, are these in a form
> > or in the query?
> >
> > "Paperback Writer" wrote:
> >
> > > I have a combo box that sits on a query. This query zeroes in on one field.
> > > I'd like about five other fields from this query to be populated based on
> > > which value is selected in the combo box.
> > >
> > > How do I do this?


 
Reply With Quote
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      31st May 2006
In the AfterUpdate event of the Combo box, try the following:

Forms!YourFormName.Filter = "YourQueryName.FieldName = " & """" &
YourComboBoxName.Text & """"

Watch out for word wrap! If you combo box is for numbers then it will look
like this:

Forms!YourFormName.Filter = "YourQueryName.FieldName = " &
YourComboBoxName.Text

I tested this on a form using an unbound combo box that was populated using
a query.

"Paperback Writer" wrote:

> When you set up a Combo Box, it asks if you want it to bring up values from a
> query or a table. I selected "query." I then asked it to only return one
> field, which is the pivotal field.
>
> The related fields are in the same query. I want those text boxes, all of
> which are inside a form, to populate depending on what is selected in the
> combo box.
>
>
> "xRoachx" wrote:
>
> > Hi PW -- Can you clarify a little? Do you mean the query is used to populate
> > the combo box? Also, what do you mean by the query zeroes in on one field?
> > Last, the five fields you want automatically populated, are these in a form
> > or in the query?
> >
> > "Paperback Writer" wrote:
> >
> > > I have a combo box that sits on a query. This query zeroes in on one field.
> > > I'd like about five other fields from this query to be populated based on
> > > which value is selected in the combo box.
> > >
> > > How do I do this?

 
Reply With Quote
 
=?Utf-8?B?UGFwZXJiYWNrIFdyaXRlcg==?=
Guest
Posts: n/a
 
      1st Jun 2006
I'm sorry, but I can't get either of these solutions to work. Please explain
step-by-step.

I put those commands in the combo box? Wouldn't I put them in the text box?
This is prolly easy, and I'm totally missing it!

What I want is something like this on my form. (bad attempt to follow at
recreating the "look" of my form)


|Combo Box Dropdown|

|Text Box Data That Auto Populates Depending On Combo Choice|

|Text Box Data That Auto Populates Depending On Combo Choice|

|Text Box Data That Auto Populates Depending On Combo Choice|

|Text Box Data That Auto Populates Depending On Combo Choice|

 
Reply With Quote
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      1st Jun 2006
Since your form is based on the query we need to do some work to display the
values you want. To do this, you are going to use criteria, i.e., your combo
box, to filter for the values you want.

So in design view of your form, drag a combo box onto the form. In the
wizard, select the query used to fill the combo box but do not select the
option to store the value.

Right click on the combo box and navigate to the Event tab. In the
AfterUpdate event click the elipse (...) and choose Code Builder in the popup
box to open the VBA editor. It is here you will place the code I gave you but
you need to modify it to include your query and field names.

"Paperback Writer" wrote:

> I'm sorry, but I can't get either of these solutions to work. Please explain
> step-by-step.
>
> I put those commands in the combo box? Wouldn't I put them in the text box?
> This is prolly easy, and I'm totally missing it!
>
> What I want is something like this on my form. (bad attempt to follow at
> recreating the "look" of my form)
>
>
> |Combo Box Dropdown|
>
> |Text Box Data That Auto Populates Depending On Combo Choice|
>
> |Text Box Data That Auto Populates Depending On Combo Choice|
>
> |Text Box Data That Auto Populates Depending On Combo Choice|
>
> |Text Box Data That Auto Populates Depending On Combo Choice|
>

 
Reply With Quote
 
Ron2006
Guest
Posts: n/a
 
      1st Jun 2006
For analysis of what is wrong we will need information more detailed
that it didn't work.

For my approach, I need the following information:

For the Combobox what are the values in the following properties
bound column = 2 from data tab
column count = 5 from Format tab
column widths = 0;1;0;0;0 from format Tab

 
Reply With Quote
 
=?Utf-8?B?UGFwZXJiYWNrIFdyaXRlcg==?=
Guest
Posts: n/a
 
      1st Jun 2006
I know less than zero about VB.

Where do I put this code?


"xRoachx" wrote:

> Since your form is based on the query we need to do some work to display the
> values you want. To do this, you are going to use criteria, i.e., your combo
> box, to filter for the values you want.
>
> So in design view of your form, drag a combo box onto the form. In the
> wizard, select the query used to fill the combo box but do not select the
> option to store the value.
>
> Right click on the combo box and navigate to the Event tab. In the
> AfterUpdate event click the elipse (...) and choose Code Builder in the popup
> box to open the VBA editor. It is here you will place the code I gave you but
> you need to modify it to include your query and field names.
>
> "Paperback Writer" wrote:
>
> > I'm sorry, but I can't get either of these solutions to work. Please explain
> > step-by-step.
> >
> > I put those commands in the combo box? Wouldn't I put them in the text box?
> > This is prolly easy, and I'm totally missing it!
> >
> > What I want is something like this on my form. (bad attempt to follow at
> > recreating the "look" of my form)
> >
> >
> > |Combo Box Dropdown|
> >
> > |Text Box Data That Auto Populates Depending On Combo Choice|
> >
> > |Text Box Data That Auto Populates Depending On Combo Choice|
> >
> > |Text Box Data That Auto Populates Depending On Combo Choice|
> >
> > |Text Box Data That Auto Populates Depending On Combo Choice|
> >

 
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
Combo Box selection populates text box copprtop116 Microsoft Access Forms 4 2nd Oct 2008 06:00 PM
Re: text box value populates combo box Douglas J. Steele Microsoft Access Form Coding 3 5th Jan 2007 08:13 AM
Re: text box value populates combo box Al Campagna Microsoft Access Form Coding 0 4th Jan 2007 03:14 PM
Combo box value populates text box =?Utf-8?B?T2xpdmVybmlj?= Microsoft Access Getting Started 3 25th Jan 2006 07:41 PM
ComboBox populates text boxes, how to edit text now? =?Utf-8?B?RHJld1RoZUZhdGhlcg==?= Microsoft Access Forms 2 9th Aug 2005 08:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:49 AM.