link combo box

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Hi All,

How do you make the combo box display only the names base
on the filter. I have two tables, user and computer. The
relationship between them is 1-to-many. Now, I created two
forms, search and information. I type the name in the
search form and it brings up the records and displayed it
in the information form. Since the user have more than one
computer, I need to click on the record selector to
display the computers the user own. Instead of clicking
the record selector, I created a combo box to do that. One
problem with the the combo box is that, it displayed all
the computers instead of the computers base on the user.
So, how do you create the combo box to display the
computers for the user.

For example:
User: Mike
Computer own: Apple,Dell,HP

In the combo box, I should see:
Apple
Dell
HP

Instead, I see all this:

Apple
Dell
HP
Compaq
Acer

how do you create the combo box to display the computers
for mike??

Thanks for the help...

mike
 
You need to setup a query and then link your combo box to the query. Once
you do that, you can run the query whenever you need to have it refreshed.
 
How??

Thanks
mike
-----Original Message-----
You need to setup a query and then link your combo box to the query. Once
you do that, you can run the query whenever you need to have it refreshed.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000




.
 
I assume you know how to create a Query By Example (QBE) in Design View from
the Database Window under the Query tab (either in Design View or with
Wizard help).

Once you have done that, you can then create a Combo box with the help of
the wizard and let the wizard guide you through the steps.

Another way, since you already have the combo box created, you can change
the Row Source Type Property to "Table/Query" and then change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM [Query1]

Note how the RowSource is using SQL syntax for the most part within the
RowSource Property. Even under this second way of linking the combo box to
the query, you still have to create the query first, which is easiest to do
with the QBE.
 
With this method, the combo box shows all the fields in
the list. How can you program the combo box to limit the
fields that I wanted.

For example,

I created the query to retrieve the computers base on the
user. Here are the fields in the query:
COMPID,COMPNAME,USERID,USERNAME.

When I added the query to the combo box, all of the fields
are shown. Can I program the combo box to lis only
COMPNAME??

Also, can you program the combox to list the COMPNAME
automatically when the form is open??

Thanks for the help...

mike
-----Original Message-----
I assume you know how to create a Query By Example (QBE) in Design View from
the Database Window under the Query tab (either in Design View or with
Wizard help).

Once you have done that, you can then create a Combo box with the help of
the wizard and let the wizard guide you through the steps.

Another way, since you already have the combo box created, you can change
the Row Source Type Property to "Table/Query" and then change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM [Query1]

Note how the RowSource is using SQL syntax for the most part within the
RowSource Property. Even under this second way of linking the combo box to
the query, you still have to create the query first, which is easiest to do
with the QBE.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

to
the query. Once created
two displayed
it than
one that.
One


.
 
Please ignore the first part. It finally works. But in the
second part, how do you automatically program the combo
box to display the computer name base on USERID and USER
name. This is what I mean:

I created a main form and this main form contains a
subform. In the subform, I have a combo box. This combox
will check the userID and userName in the main form and
from there, it will do a query and display the data base
on the userID and user name. How do you program the combo
box to do this??

For example:

Main form
userID:
username:

Subform within the main form
combo box
(This combo box takes the userID and username from the
main form and do a query)


Thnaks for the help...

mike
-----Original Message-----
With this method, the combo box shows all the fields in
the list. How can you program the combo box to limit the
fields that I wanted.

For example,

I created the query to retrieve the computers base on the
user. Here are the fields in the query:
COMPID,COMPNAME,USERID,USERNAME.

When I added the query to the combo box, all of the fields
are shown. Can I program the combo box to lis only
COMPNAME??

Also, can you program the combox to list the COMPNAME
automatically when the form is open??

Thanks for the help...

mike
-----Original Message-----
I assume you know how to create a Query By Example (QBE) in Design View from
the Database Window under the Query tab (either in
Design
View or with
Wizard help).

Once you have done that, you can then create a Combo box with the help of
the wizard and let the wizard guide you through the steps.

Another way, since you already have the combo box created, you can change
the Row Source Type Property to "Table/Query" and then change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM [Query1]

Note how the RowSource is using SQL syntax for the most part within the
RowSource Property. Even under this second way of linking the combo box to
the query, you still have to create the query first, which is easiest to do
with the QBE.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

How??

Thanks
mike
-----Original Message-----
You need to setup a query and then link your combo
box
computer.
displayed
.
 
Given that the Row Source does accept SQL Statements, you can add a WHERE
clause to your Row Source such as what's shown below:

You can put in the After Update Event of your User ID combo box

Me.cbxComp.RowSource = "SELECT [Query1].[fldCompID], " & _
"[Query1].[fldCompName] FROM [Query1] WHERE [Query1].[fldCompID] = " & _
CStr(Me.cbxUserID.Value)

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

mike said:
Please ignore the first part. It finally works. But in the
second part, how do you automatically program the combo
box to display the computer name base on USERID and USER
name. This is what I mean:

I created a main form and this main form contains a
subform. In the subform, I have a combo box. This combox
will check the userID and userName in the main form and
from there, it will do a query and display the data base
on the userID and user name. How do you program the combo
box to do this??

For example:

Main form
userID:
username:

Subform within the main form
combo box
(This combo box takes the userID and username from the
main form and do a query)


Thnaks for the help...

mike
-----Original Message-----
With this method, the combo box shows all the fields in
the list. How can you program the combo box to limit the
fields that I wanted.

For example,

I created the query to retrieve the computers base on the
user. Here are the fields in the query:
COMPID,COMPNAME,USERID,USERNAME.

When I added the query to the combo box, all of the fields
are shown. Can I program the combo box to lis only
COMPNAME??

Also, can you program the combox to list the COMPNAME
automatically when the form is open??

Thanks for the help...

mike
-----Original Message-----
I assume you know how to create a Query By Example (QBE) in Design View from
the Database Window under the Query tab (either in
Design
View or with
Wizard help).

Once you have done that, you can then create a Combo box with the help of
the wizard and let the wizard guide you through the steps.

Another way, since you already have the combo box created, you can change
the Row Source Type Property to "Table/Query" and then change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM [Query1]

Note how the RowSource is using SQL syntax for the most part within the
RowSource Property. Even under this second way of linking the combo box to
the query, you still have to create the query first, which is easiest to do
with the QBE.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000


How??

Thanks
mike
-----Original Message-----
You need to setup a query and then link your combo
box
to
the query. Once
you do that, you can run the query whenever you need to
have it refreshed.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

message
Hi All,

How do you make the combo box display only the names
base
on the filter. I have two tables, user and
computer.
The
relationship between them is 1-to-many. Now, I created
two
forms, search and information. I type the name in the
search form and it brings up the records and displayed
it
in the information form. Since the user have more than
one
computer, I need to click on the record selector to
display the computers the user own. Instead of clicking
the record selector, I created a combo box to do that.
One
problem with the the combo box is that, it
displayed
all
the computers instead of the computers base on the user.
So, how do you create the combo box to display the
computers for the user.

For example:
User: Mike
Computer own: Apple,Dell,HP

In the combo box, I should see:
Apple
Dell
HP

Instead, I see all this:

Apple
Dell
HP
Compaq
Acer

how do you create the combo box to display the computers
for mike??

Thanks for the help...

mike



.



.
.
 
Thanks Ronald. It works now. once again, thanks you for
your help.

mike
-----Original Message-----
Given that the Row Source does accept SQL Statements, you can add a WHERE
clause to your Row Source such as what's shown below:

You can put in the After Update Event of your User ID combo box

Me.cbxComp.RowSource = "SELECT [Query1].[fldCompID], " & _
"[Query1].[fldCompName] FROM [Query1] WHERE [Query1]. [fldCompID] = " & _
CStr(Me.cbxUserID.Value)

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

Please ignore the first part. It finally works. But in the
second part, how do you automatically program the combo
box to display the computer name base on USERID and USER
name. This is what I mean:

I created a main form and this main form contains a
subform. In the subform, I have a combo box. This combox
will check the userID and userName in the main form and
from there, it will do a query and display the data base
on the userID and user name. How do you program the combo
box to do this??

For example:

Main form
userID:
username:

Subform within the main form
combo box
(This combo box takes the userID and username from the
main form and do a query)


Thnaks for the help...

mike
-----Original Message-----
With this method, the combo box shows all the fields in
the list. How can you program the combo box to limit the
fields that I wanted.

For example,

I created the query to retrieve the computers base on the
user. Here are the fields in the query:
COMPID,COMPNAME,USERID,USERNAME.

When I added the query to the combo box, all of the fields
are shown. Can I program the combo box to lis only
COMPNAME??

Also, can you program the combox to list the COMPNAME
automatically when the form is open??

Thanks for the help...

mike
-----Original Message-----
I assume you know how to create a Query By Example (QBE)
in Design View from
the Database Window under the Query tab (either in Design
View or with
Wizard help).

Once you have done that, you can then create a Combo box
with the help of
the wizard and let the wizard guide you through the steps.

Another way, since you already have the combo box
created, you can change
the Row Source Type Property to "Table/Query" and then
change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM
[Query1]

Note how the RowSource is using SQL syntax for the most
part within the
RowSource Property. Even under this second way of
linking the combo box to
the query, you still have to create the query first,
which is easiest to do
with the QBE.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

message

How??

Thanks
mike
-----Original Message-----
You need to setup a query and then link your combo box
to
the query. Once
you do that, you can run the query whenever you
need
to
have it refreshed.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

message
Hi All,

How do you make the combo box display only the names
base
on the filter. I have two tables, user and computer.
The
relationship between them is 1-to-many. Now, I
created
two
forms, search and information. I type the name in the
search form and it brings up the records and
displayed
it
in the information form. Since the user have more
than
one
computer, I need to click on the record selector to
display the computers the user own. Instead of
clicking
the record selector, I created a combo box to do
that.
One
problem with the the combo box is that, it displayed
all
the computers instead of the computers base on the
user.
So, how do you create the combo box to display the
computers for the user.

For example:
User: Mike
Computer own: Apple,Dell,HP

In the combo box, I should see:
Apple
Dell
HP

Instead, I see all this:

Apple
Dell
HP
Compaq
Acer

how do you create the combo box to display the
computers
for mike??

Thanks for the help...

mike



.



.

.


.
 
You quite welcome, that's what us peers are here for, to help each other
out. I been working a lot with VBA (more so with Excel until the last 6
months) and SQL Statements (in a third party program) for nearly 5 years
now. I have worked some with Access here and there prior to the last 6
months, but it's only been the last 6 months that I have gotten quite deep
into Access and DAO coding. I'm currently working on a rather large project
at the present time and it would normally be done by a team of people, but
it's just me as I don't have that option.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

mike said:
Thanks Ronald. It works now. once again, thanks you for
your help.

mike
-----Original Message-----
Given that the Row Source does accept SQL Statements, you can add a WHERE
clause to your Row Source such as what's shown below:

You can put in the After Update Event of your User ID combo box

Me.cbxComp.RowSource = "SELECT [Query1].[fldCompID], " & _
"[Query1].[fldCompName] FROM [Query1] WHERE [Query1]. [fldCompID] = " & _
CStr(Me.cbxUserID.Value)

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

Please ignore the first part. It finally works. But in the
second part, how do you automatically program the combo
box to display the computer name base on USERID and USER
name. This is what I mean:

I created a main form and this main form contains a
subform. In the subform, I have a combo box. This combox
will check the userID and userName in the main form and
from there, it will do a query and display the data base
on the userID and user name. How do you program the combo
box to do this??

For example:

Main form
userID:
username:

Subform within the main form
combo box
(This combo box takes the userID and username from the
main form and do a query)


Thnaks for the help...

mike
-----Original Message-----
With this method, the combo box shows all the fields in
the list. How can you program the combo box to limit the
fields that I wanted.

For example,

I created the query to retrieve the computers base on the
user. Here are the fields in the query:
COMPID,COMPNAME,USERID,USERNAME.

When I added the query to the combo box, all of the
fields
are shown. Can I program the combo box to lis only
COMPNAME??

Also, can you program the combox to list the COMPNAME
automatically when the form is open??

Thanks for the help...

mike
-----Original Message-----
I assume you know how to create a Query By Example (QBE)
in Design View from
the Database Window under the Query tab (either in
Design
View or with
Wizard help).

Once you have done that, you can then create a Combo box
with the help of
the wizard and let the wizard guide you through the
steps.

Another way, since you already have the combo box
created, you can change
the Row Source Type Property to "Table/Query" and then
change your Row
Source to something like the following:

SELECT [Query1].[fldCompID], [Query1].[fldCompName] FROM
[Query1]

Note how the RowSource is using SQL syntax for the most
part within the
RowSource Property. Even under this second way of
linking the combo box to
the query, you still have to create the query first,
which is easiest to do
with the QBE.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

message

How??

Thanks
mike
-----Original Message-----
You need to setup a query and then link your combo
box
to
the query. Once
you do that, you can run the query whenever you need
to
have it refreshed.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

message
Hi All,

How do you make the combo box display only the names
base
on the filter. I have two tables, user and
computer.
The
relationship between them is 1-to-many. Now, I
created
two
forms, search and information. I type the name in
the
search form and it brings up the records and
displayed
it
in the information form. Since the user have more
than
one
computer, I need to click on the record selector to
display the computers the user own. Instead of
clicking
the record selector, I created a combo box to do
that.
One
problem with the the combo box is that, it
displayed
all
the computers instead of the computers base on the
user.
So, how do you create the combo box to display the
computers for the user.

For example:
User: Mike
Computer own: Apple,Dell,HP

In the combo box, I should see:
Apple
Dell
HP

Instead, I see all this:

Apple
Dell
HP
Compaq
Acer

how do you create the combo box to display the
computers
for mike??

Thanks for the help...

mike



.



.

.


.
 
Back
Top