A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combo Box Problem



 
 
Thread Tools Display Modes
  #1  
Old July 7th, 2004, 10:52 PM
Mr. T
external usenet poster
 
Posts: n/a
Default Combo Box Problem

I have a form that contains two combo boxes. My plan is
that the first combo box will select a name, and then the
second combo box would only contain the specific tasks
that correspond with the name selected in box one (it
currently contains all the tasks for all the names in
combo box 1). I think I have to adjust either the control
source or the after update field, but I am unsure how to
accomplish the goal. Any suggestions?
  #2  
Old July 8th, 2004, 01:08 AM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

The record source for the second combo should be a query that is filtered by the value in the first combo. In the After_Update event of the first combo, requery the second combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID, tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]![cboName]));

If this isn't enough information/direction to help you, then you'll need to post specifics about the related tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My plan is
that the first combo box will select a name, and then the
second combo box would only contain the specific tasks
that correspond with the name selected in box one (it
currently contains all the tasks for all the names in
combo box 1). I think I have to adjust either the control
source or the after update field, but I am unsure how to
accomplish the goal. Any suggestions?

  #3  
Old July 14th, 2004, 05:49 PM
Mr. T
external usenet poster
 
Posts: n/a
Default Combo Box Problem

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?

2. You've advised us that "..the record source for the
second combo should be a query that is filtered by the
value in the first combo. Since we have 3 different NameID
options (Joyce, Linda, Susan), how do we use one query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each name
where we enter the name in our criteria row of the query.

3. You've mentioned that we need to update the "record
source" field in our form -- I don't see a "record source"
field, I do see a "row source" field. Is this the same
field?

4. You've advised us to "...In the After_Update event of
the first combo, requery the second combo". What does this
mean -- have you detailed this in your initial response?

Thanks for the help.






-----Original Message-----
The record source for the second combo should be a query

that is filtered by the value in the first combo. In the
After_Update event of the first combo, requery the second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!

[cboName]));

If this isn't enough information/direction to help you,

then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My plan

is
that the first combo box will select a name, and then

the
second combo box would only contain the specific tasks
that correspond with the name selected in box one (it
currently contains all the tasks for all the names in
combo box 1). I think I have to adjust either the

control
source or the after update field, but I am unsure how

to
accomplish the goal. Any suggestions?

.

  #4  
Old July 14th, 2004, 06:49 PM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?


From the databse window, select 'Create table in Design view' or 'Create table by using wizard'. The field is an autonumber primary key for the table. (This question is sorta scary - you don't know how to build a table? If not, I'm afraid I couldn't detail all of the steps very well. Besides, there are several books available that would do a better job than I could do. And don't forget about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for the
second combo should be a query that is filtered by the
value in the first combo. Since we have 3 different NameID
options (Joyce, Linda, Susan), how do we use one query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each name
where we enter the name in our criteria row of the query.


If your table is set up correctly, then Joyce = NameID 1, Linda = 2, Susan = 3. When the first combo selects "Joyce", the ID is 1. The second combo uses '1' as the filter criteria. There is no need for three queries when you use the code provided.


3. You've mentioned that we need to update the "record
source" field in our form -- I don't see a "record source"
field, I do see a "row source" field. Is this the same
field?


Yes, "row source" is the correct terminology - sorry for any confusion it caused you.

4. You've advised us to "...In the After_Update event of
the first combo, requery the second combo". What does this
mean -- have you detailed this in your initial response?


Open the Properties for the first combo, click the Event tab, in the list of events find "After Update", click in the field and a drop-down arrow appears. From the drop-down list select [Event Procedure]. Then click the elipsis (...) to the right of the field. This will open VBA and that is where the code goes. Here is the code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.


You're welcome.






-----Original Message-----
The record source for the second combo should be a query

that is filtered by the value in the first combo. In the
After_Update event of the first combo, requery the second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!

[cboName]));

If this isn't enough information/direction to help you,

then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My plan

is
that the first combo box will select a name, and then

the
second combo box would only contain the specific tasks
that correspond with the name selected in box one (it
currently contains all the tasks for all the names in
combo box 1). I think I have to adjust either the

control
source or the after update field, but I am unsure how

to
accomplish the goal. Any suggestions?

.


  #5  
Old July 14th, 2004, 07:00 PM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

Oops, I think I can add a little more.....
--
rpw


"rpw" wrote:

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?


From the databse window, select 'Create table in Design view' or 'Create table by using wizard'. The field is an autonumber primary key for the table. (This question is sorta scary - you don't know how to build a table? If not, I'm afraid I couldn't detail all of the steps very well. Besides, there are several books available that would do a better job than I could do. And don't forget about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for the
second combo should be a query that is filtered by the
value in the first combo. Since we have 3 different NameID
options (Joyce, Linda, Susan), how do we use one query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each name
where we enter the name in our criteria row of the query.


If your table is set up correctly, then Joyce = NameID 1, Linda = 2, Susan = 3. When the first combo selects "Joyce", the ID is 1. The second combo uses '1' as the filter criteria. There is no need for three queries when you use the code provided.


Not code exactly, but SQL. In the row source property of the second combo, paste the following:

SELECT tblTaskAssignments.AssignID, tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!
[cboName]));

(Of course, if your table names, field names, form names, control names are different, then you must change this SQL to reflect your names.)



3. You've mentioned that we need to update the "record
source" field in our form -- I don't see a "record source"
field, I do see a "row source" field. Is this the same
field?


Yes, "row source" is the correct terminology - sorry for any confusion it caused you.

4. You've advised us to "...In the After_Update event of
the first combo, requery the second combo". What does this
mean -- have you detailed this in your initial response?


Open the Properties for the first combo, click the Event tab, in the list of events find "After Update", click in the field and a drop-down arrow appears. From the drop-down list select [Event Procedure]. Then click the elipsis (...) to the right of the field. This will open VBA and that is where the code goes. Here is the code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.


You're welcome.






-----Original Message-----
The record source for the second combo should be a query

that is filtered by the value in the first combo. In the
After_Update event of the first combo, requery the second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!

[cboName]));

If this isn't enough information/direction to help you,

then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My plan

is
that the first combo box will select a name, and then

the
second combo box would only contain the specific tasks
that correspond with the name selected in box one (it
currently contains all the tasks for all the names in
combo box 1). I think I have to adjust either the

control
source or the after update field, but I am unsure how

to
accomplish the goal. Any suggestions?

.


  #6  
Old July 14th, 2004, 09:41 PM
Mr. T.
external usenet poster
 
Posts: n/a
Default Combo Box Problem

Rest assured I know how to create a table -- I was asking
how you wanted to create this table using the row source
or some other field in the form.

I understand most everything you've stated, but I have an
error in my second combo table. I think it has to do with
the "[Forms]!" reference in your WHERE statement. I think
I need to replace "[Forms]!" with one of my field, table,
combo or forms name, but I don't know for sure. What I've
tried has not worked.

Once I get this working, I have another question. Once the
Owner, and the Task have been selected, I need to run a
query that will take our owner (Joyce) and the task
they've selected (Update) and read another table that has
multiple records with "Update" as the common task. This
could be hundreds of records, so I cannot use the form to
show these. Is there an way to write one query that will
recognize the Owner and the task and only pull in the
appropriate records from a third table, named "Required"?

Thanks for your continued help.


-----Original Message-----
Oops, I think I can add a little more.....
--
rpw


"rpw" wrote:

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?


From the databse window, select 'Create table in Design

view' or 'Create table by using wizard'. The field is an
autonumber primary key for the table. (This question is
sorta scary - you don't know how to build a table? If
not, I'm afraid I couldn't detail all of the steps very
well. Besides, there are several books available that
would do a better job than I could do. And don't forget
about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for

the
second combo should be a query that is filtered by

the
value in the first combo. Since we have 3 different

NameID
options (Joyce, Linda, Susan), how do we use one

query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each

name
where we enter the name in our criteria row of the

query.

If your table is set up correctly, then Joyce = NameID

1, Linda = 2, Susan = 3. When the first combo
selects "Joyce", the ID is 1. The second combo uses '1'
as the filter criteria. There is no need for three
queries when you use the code provided.

Not code exactly, but SQL. In the row source property of

the second combo, paste the following:

SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!
[cboName]));

(Of course, if your table names, field names, form names,

control names are different, then you must change this SQL
to reflect your names.)



3. You've mentioned that we need to update

the "record
source" field in our form -- I don't see a "record

source"
field, I do see a "row source" field. Is this the

same
field?


Yes, "row source" is the correct terminology - sorry

for any confusion it caused you.

4. You've advised us to "...In the After_Update event

of
the first combo, requery the second combo". What does

this
mean -- have you detailed this in your initial

response?

Open the Properties for the first combo, click the

Event tab, in the list of events find "After Update",
click in the field and a drop-down arrow appears. From
the drop-down list select [Event Procedure]. Then click
the elipsis (...) to the right of the field. This will
open VBA and that is where the code goes. Here is the
code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.


You're welcome.






-----Original Message-----
The record source for the second combo should be a

query
that is filtered by the value in the first combo. In

the
After_Update event of the first combo, requery the

second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,
tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]!

[frmMyForm]!
[cboName]));

If this isn't enough information/direction to help

you,
then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My

plan
is
that the first combo box will select a name, and

then
the
second combo box would only contain the specific

tasks
that correspond with the name selected in box one

(it
currently contains all the tasks for all the names

in
combo box 1). I think I have to adjust either the
control
source or the after update field, but I am unsure

how
to
accomplish the goal. Any suggestions?

.


.

  #7  
Old July 14th, 2004, 10:18 PM
Mr. T.
external usenet poster
 
Posts: n/a
Default Combo Box Problem

Actually, I now have this working. Except, if I pick
Joyce, I get the 10 task in second combo box that relate
to her. If I then Select Linda from the first combo box, I
still show Joyce's 10 tasks. Do I need to add something to
the "On Change" field of the second combo box?


-----Original Message-----
Oops, I think I can add a little more.....
--
rpw


"rpw" wrote:

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?


From the databse window, select 'Create table in Design

view' or 'Create table by using wizard'. The field is an
autonumber primary key for the table. (This question is
sorta scary - you don't know how to build a table? If
not, I'm afraid I couldn't detail all of the steps very
well. Besides, there are several books available that
would do a better job than I could do. And don't forget
about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for

the
second combo should be a query that is filtered by

the
value in the first combo. Since we have 3 different

NameID
options (Joyce, Linda, Susan), how do we use one

query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each

name
where we enter the name in our criteria row of the

query.

If your table is set up correctly, then Joyce = NameID

1, Linda = 2, Susan = 3. When the first combo
selects "Joyce", the ID is 1. The second combo uses '1'
as the filter criteria. There is no need for three
queries when you use the code provided.

Not code exactly, but SQL. In the row source property of

the second combo, paste the following:

SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!
[cboName]));

(Of course, if your table names, field names, form names,

control names are different, then you must change this SQL
to reflect your names.)



3. You've mentioned that we need to update

the "record
source" field in our form -- I don't see a "record

source"
field, I do see a "row source" field. Is this the

same
field?


Yes, "row source" is the correct terminology - sorry

for any confusion it caused you.

4. You've advised us to "...In the After_Update event

of
the first combo, requery the second combo". What does

this
mean -- have you detailed this in your initial

response?

Open the Properties for the first combo, click the

Event tab, in the list of events find "After Update",
click in the field and a drop-down arrow appears. From
the drop-down list select [Event Procedure]. Then click
the elipsis (...) to the right of the field. This will
open VBA and that is where the code goes. Here is the
code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.


You're welcome.






-----Original Message-----
The record source for the second combo should be a

query
that is filtered by the value in the first combo. In

the
After_Update event of the first combo, requery the

second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,
tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]!

[frmMyForm]!
[cboName]));

If this isn't enough information/direction to help

you,
then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My

plan
is
that the first combo box will select a name, and

then
the
second combo box would only contain the specific

tasks
that correspond with the name selected in box one

(it
currently contains all the tasks for all the names

in
combo box 1). I think I have to adjust either the
control
source or the after update field, but I am unsure

how
to
accomplish the goal. Any suggestions?

.


.

  #8  
Old July 14th, 2004, 11:38 PM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

If the row source for the second combo is a SQL statement like the one I provided, then you need to put a 'requery' instruction in the after update of the first combo. This will then cause the change to happen correctly. Check my answer to your question number 4.

And I'm glad to know that you do know how to build tables - sorry for misunderstanding you.

--
rpw


"Mr. T." wrote:

Actually, I now have this working. Except, if I pick
Joyce, I get the 10 task in second combo box that relate
to her. If I then Select Linda from the first combo box, I
still show Joyce's 10 tasks. Do I need to add something to
the "On Change" field of the second combo box?


-----Original Message-----
Oops, I think I can add a little more.....
--
rpw


"rpw" wrote:

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?

From the databse window, select 'Create table in Design

view' or 'Create table by using wizard'. The field is an
autonumber primary key for the table. (This question is
sorta scary - you don't know how to build a table? If
not, I'm afraid I couldn't detail all of the steps very
well. Besides, there are several books available that
would do a better job than I could do. And don't forget
about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for

the
second combo should be a query that is filtered by

the
value in the first combo. Since we have 3 different

NameID
options (Joyce, Linda, Susan), how do we use one

query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each

name
where we enter the name in our criteria row of the

query.

If your table is set up correctly, then Joyce = NameID

1, Linda = 2, Susan = 3. When the first combo
selects "Joyce", the ID is 1. The second combo uses '1'
as the filter criteria. There is no need for three
queries when you use the code provided.

Not code exactly, but SQL. In the row source property of

the second combo, paste the following:

SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!
[cboName]));

(Of course, if your table names, field names, form names,

control names are different, then you must change this SQL
to reflect your names.)



3. You've mentioned that we need to update

the "record
source" field in our form -- I don't see a "record

source"
field, I do see a "row source" field. Is this the

same
field?

Yes, "row source" is the correct terminology - sorry

for any confusion it caused you.

4. You've advised us to "...In the After_Update event

of
the first combo, requery the second combo". What does

this
mean -- have you detailed this in your initial

response?

Open the Properties for the first combo, click the

Event tab, in the list of events find "After Update",
click in the field and a drop-down arrow appears. From
the drop-down list select [Event Procedure]. Then click
the elipsis (...) to the right of the field. This will
open VBA and that is where the code goes. Here is the
code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.

You're welcome.






-----Original Message-----
The record source for the second combo should be a

query
that is filtered by the value in the first combo. In

the
After_Update event of the first combo, requery the

second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,
tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]!

[frmMyForm]!
[cboName]));

If this isn't enough information/direction to help

you,
then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My

plan
is
that the first combo box will select a name, and

then
the
second combo box would only contain the specific

tasks
that correspond with the name selected in box one

(it
currently contains all the tasks for all the names

in
combo box 1). I think I have to adjust either the
control
source or the after update field, but I am unsure

how
to
accomplish the goal. Any suggestions?

.


.


  #9  
Old July 14th, 2004, 11:47 PM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

comments in-line....
--
rpw


"Mr. T." wrote:

Rest assured I know how to create a table -- I was asking
how you wanted to create this table using the row source
or some other field in the form.

I understand most everything you've stated, but I have an
error in my second combo table. I think it has to do with
the "[Forms]!" reference in your WHERE statement. I think
I need to replace "[Forms]!" with one of my field, table,
combo or forms name, but I don't know for sure. What I've
tried has not worked.


"[Forms]![frmMyForm]![cboName]" is all one collection identifying the combo named cboName that is on the form named frmMyForm that is in the object class of Forms. You should substitute your form name for "frmMyForm" and your combo name for "cboName". "[Forms]!" is standard Access stuff and you probably shouldn't change that.

(notebject class may be the wrong terminology, but I hope you get the idea)


Once I get this working, I have another question. Once the
Owner, and the Task have been selected, I need to run a
query that will take our owner (Joyce) and the task
they've selected (Update) and read another table that has
multiple records with "Update" as the common task. This
could be hundreds of records, so I cannot use the form to
show these. Is there an way to write one query that will
recognize the Owner and the task and only pull in the
appropriate records from a third table, named "Required"?

Thanks for your continued help.


-----Original Message-----
Oops, I think I can add a little more.....
--
rpw


"rpw" wrote:

Comments in-line below.....
--
rpw


"Mr. T" wrote:

We have a few more questions, please:
1. how do we generate the table
named "tblTaskAssignments", and where does the
field "AssignID" come from?

From the databse window, select 'Create table in Design

view' or 'Create table by using wizard'. The field is an
autonumber primary key for the table. (This question is
sorta scary - you don't know how to build a table? If
not, I'm afraid I couldn't detail all of the steps very
well. Besides, there are several books available that
would do a better job than I could do. And don't forget
about the Access help off-line and on-line resources.)


2. You've advised us that "..the record source for

the
second combo should be a query that is filtered by

the
value in the first combo. Since we have 3 different

NameID
options (Joyce, Linda, Susan), how do we use one

query to
filter based on the selection of one of these -- my
thoughts are that we need 3 queries, one for each

name
where we enter the name in our criteria row of the

query.

If your table is set up correctly, then Joyce = NameID

1, Linda = 2, Susan = 3. When the first combo
selects "Joyce", the ID is 1. The second combo uses '1'
as the filter criteria. There is no need for three
queries when you use the code provided.

Not code exactly, but SQL. In the row source property of

the second combo, paste the following:

SELECT tblTaskAssignments.AssignID,

tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]![frmMyForm]!
[cboName]));

(Of course, if your table names, field names, form names,

control names are different, then you must change this SQL
to reflect your names.)



3. You've mentioned that we need to update

the "record
source" field in our form -- I don't see a "record

source"
field, I do see a "row source" field. Is this the

same
field?

Yes, "row source" is the correct terminology - sorry

for any confusion it caused you.

4. You've advised us to "...In the After_Update event

of
the first combo, requery the second combo". What does

this
mean -- have you detailed this in your initial

response?

Open the Properties for the first combo, click the

Event tab, in the list of events find "After Update",
click in the field and a drop-down arrow appears. From
the drop-down list select [Event Procedure]. Then click
the elipsis (...) to the right of the field. This will
open VBA and that is where the code goes. Here is the
code:

Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub


Thanks for the help.

You're welcome.






-----Original Message-----
The record source for the second combo should be a

query
that is filtered by the value in the first combo. In

the
After_Update event of the first combo, requery the

second
combo.

tblNames
NameID

tblTasks
TaskID

tblTaskAssignments
AssignID
TaskID
NameID

cboName
record source = tblNames
After Update event code:
Private Sub cboName_AfterUpdate()
Me.cboTask.Requery
End Sub

cboTask
record source =
SELECT tblTaskAssignments.AssignID,
tblTaskAssignments.TaskID, tblTaskAssignments.NameID
FROM tblTaskAssignments
WHERE (((tblTaskAssignments.NameID)=[Forms]!

[frmMyForm]!
[cboName]));

If this isn't enough information/direction to help

you,
then you'll need to post specifics about the related
tables, fields, and control names.
--
rpw


"Mr. T" wrote:

I have a form that contains two combo boxes. My

plan
is
that the first combo box will select a name, and

then
the
second combo box would only contain the specific

tasks
that correspond with the name selected in box one

(it
currently contains all the tasks for all the names

in
combo box 1). I think I have to adjust either the
control
source or the after update field, but I am unsure

how
to
accomplish the goal. Any suggestions?

.


.


  #10  
Old July 15th, 2004, 04:39 PM
rpw
external usenet poster
 
Posts: n/a
Default Combo Box Problem

"Mr. T." wrote:

Once I get this working, I have another question. Once the
Owner, and the Task have been selected, I need to run a
query that will take our owner (Joyce) and the task
they've selected (Update) and read another table that has
multiple records with "Update" as the common task. This
could be hundreds of records, so I cannot use the form to
show these. Is there an way to write one query that will
recognize the Owner and the task and only pull in the
appropriate records from a third table, named "Required"?

Thanks for your continued help.


Hi Mr. T,

Yes, but I would need to know the table structure with exact table and field names, the name of the form, and also the associated control names on the form you are using. That way I can build/duplicate something here. With a duplicate, then we're both looking at the same thing (almost).

rpw
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem refreshing combo box dp Using Forms 8 July 3rd, 2004 05:37 PM
Need help with cascading combos Tom Using Forms 19 July 1st, 2004 11:11 PM
PGP problem Bob Henson General Discussion 0 June 27th, 2004 11:28 AM
Cascading Combo Boxes Tom Using Forms 1 June 9th, 2004 02:04 AM
Data Dependencies between Combo Boxes Tom Using Forms 7 June 6th, 2004 05:25 PM


All times are GMT +1. The time now is 10:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.