Synchronize 2 combo boxes

G

Guest

I have a combo box cboCategory that is unbound, its set to field value and
table named
"Category" (which is just a table that i created as a lookup table for my
"Equipment" input form.)

I wish to be able to select from the category list which then filters my
second combo
cboEquipName so that only the products that fall into that category are
visible to select
a particular item, so that the user doesn't have to scroll through a massive
list.

I have looked at examples and the best code i could understand was this that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box two it
seems to be
an empty query or something with about 4 columns and a scroll bar but there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a lookup so
only has one text
column. IS this ok or do i have to have primary keys or unique values that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
T

tina

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is. forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it. set the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct names
of those fields in that table; you didn't mention the "real" names in your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that procedure), as

Me!CboEquipName.Requery

hth
 
G

Guest

Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it doesn't like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

tina said:
well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is. forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it. set the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct names
of those fields in that table; you didn't mention the "real" names in your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that procedure), as

Me!CboEquipName.Requery

hth


tboyce said:
I have a combo box cboCategory that is unbound, its set to field value and
table named
"Category" (which is just a table that i created as a lookup table for my
"Equipment" input form.)

I wish to be able to select from the category list which then filters my
second combo
cboEquipName so that only the products that fall into that category are
visible to select
a particular item, so that the user doesn't have to scroll through a massive
list.

I have looked at examples and the best code i could understand was this that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box two it
seems to be
an empty query or something with about 4 columns and a scroll bar but there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a lookup so
only has one text
column. IS this ok or do i have to have primary keys or unique values that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
T

tina

i can't see your database, Lisa, so you'll have to tell me what you've done
before i can tell you where you may have made a mistake. start by by telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it exactly
as it is in the property.

hth


tboyce said:
Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it doesn't like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

tina said:
well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is. forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it. set the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct names
of those fields in that table; you didn't mention the "real" names in your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that procedure), as

Me!CboEquipName.Requery

hth


tboyce said:
I have a combo box cboCategory that is unbound, its set to field
value
and
table named
"Category" (which is just a table that i created as a lookup table for my
"Equipment" input form.)

I wish to be able to select from the category list which then filters my
second combo
cboEquipName so that only the products that fall into that category are
visible to select
a particular item, so that the user doesn't have to scroll through a massive
list.

I have looked at examples and the best code i could understand was
this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box two it
seems to be
an empty query or something with about 4 columns and a scroll bar but there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a lookup so
only has one text
column. IS this ok or do i have to have primary keys or unique values that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
G

Guest

My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested to the
record source of my second cboEquipName. Though now if have pasted it here it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo boxes
are stored


tina said:
i can't see your database, Lisa, so you'll have to tell me what you've done
before i can tell you where you may have made a mistake. start by by telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it exactly
as it is in the property.

hth


tboyce said:
Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it doesn't like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

tina said:
well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is. forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it. set the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct names
of those fields in that table; you didn't mention the "real" names in your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to field value
and
table named
"Category" (which is just a table that i created as a lookup table for my
"Equipment" input form.)

I wish to be able to select from the category list which then filters my
second combo
cboEquipName so that only the products that fall into that category are
visible to select
a particular item, so that the user doesn't have to scroll through a
massive
list.

I have looked at examples and the best code i could understand was this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box two it
seems to be
an empty query or something with about 4 columns and a scroll bar but
there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a lookup so
only has one text
column. IS this ok or do i have to have primary keys or unique values that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
T

tina

okay, what you didn't do was replace the names i gave that table and its'
fields, with the "real" names of those objects in your database. also, you
didn't say that you're using a subform; that makes a considerable difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


tboyce said:
My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested to the
record source of my second cboEquipName. Though now if have pasted it here it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo boxes
are stored


tina said:
i can't see your database, Lisa, so you'll have to tell me what you've done
before i can tell you where you may have made a mistake. start by by telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it exactly
as it is in the property.

hth


tboyce said:
Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it doesn't like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

:

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is. forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the
correct
names
of those fields in that table; you didn't mention the "real" names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to field value
and
table named
"Category" (which is just a table that i created as a lookup table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
are
visible to select
a particular item, so that the user doesn't have to scroll through a
massive
list.

I have looked at examples and the best code i could understand was this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box
two
it
seems to be
an empty query or something with about 4 columns and a scroll bar but
there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a
lookup
so
only has one text
column. IS this ok or do i have to have primary keys or unique
values
that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
G

Guest

I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

My Main Form is called Quotebuilder and no the combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i know we
close to getting it. Thank you

tina said:
okay, what you didn't do was replace the names i gave that table and its'
fields, with the "real" names of those objects in your database. also, you
didn't say that you're using a subform; that makes a considerable difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


tboyce said:
My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested to the
record source of my second cboEquipName. Though now if have pasted it here it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo boxes
are stored


tina said:
i can't see your database, Lisa, so you'll have to tell me what you've done
before i can tell you where you may have made a mistake. start by by telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it doesn't like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

:

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is.
forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it. set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct
names
of those fields in that table; you didn't mention the "real" names in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to field
value
and
table named
"Category" (which is just a table that i created as a lookup table for
my
"Equipment" input form.)

I wish to be able to select from the category list which then filters
my
second combo
cboEquipName so that only the products that fall into that category
are
visible to select
a particular item, so that the user doesn't have to scroll through a
massive
list.

I have looked at examples and the best code i could understand was
this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is no
selection of
categories to choose from. When i go to that option and go to box two
it
seems to be
an empty query or something with about 4 columns and a scroll bar but
there
is no data
in it. Can someone please have a look and try to point me in the right
direction. All
examples seem to be based on ID's = ID's but my table is only a lookup
so
only has one text
column. IS this ok or do i have to have primary keys or unique values
that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
T

tina

comments inline.

tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take another look
at the RowSource property and correct it.
My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i know we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object, just like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that makes the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design view. on
the Toolbox toolbar, look for the button called Control Wizards (looks like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the control has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll understand it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the Properties box.
if you're using A2000 or newer, click on the subform control *twice*, and
the *subform object* is selected (instead of the subform control), and the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have the same
name as the subform object. if that's the case in your situation, it's not a
problem. (i usually make sure that my subform control has a different name
than the subform object it contains, to make it easier to tell the two apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control in the
form we've been working with. post back with the name, and i'll give you the
correct syntax for your combo box control's RowSource.

hth

tina said:
okay, what you didn't do was replace the names i gave that table and its'
fields, with the "real" names of those objects in your database. also, you
didn't say that you're using a subform; that makes a considerable difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


tboyce said:
My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested to the
record source of my second cboEquipName. Though now if have pasted it
here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what
you've
done
before i can tell you where you may have made a mistake. start by by telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now works
correctly (ace) but the second box is still blank, though it
doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks Lisa

:

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is.
forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select
it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following control
properties, as

ControlSource: <the name of the equipment field in the table that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the correct
names
of those fields in that table; you didn't mention the "real"
names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to field
value
and
table named
"Category" (which is just a table that i created as a lookup
table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then filters
my
second combo
cboEquipName so that only the products that fall into that category
are
visible to select
a particular item, so that the user doesn't have to scroll
through
a
massive
list.

I have looked at examples and the best code i could understand was
this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just
that,there is
no
selection of
categories to choose from. When i go to that option and go to
box
two
it
seems to be
an empty query or something with about 4 columns and a scroll
bar
but
there
is no data
in it. Can someone please have a look and try to point me in
the
right
direction. All
examples seem to be based on ID's = ID's but my table is only
a
lookup
so
only has one text
column. IS this ok or do i have to have primary keys or unique values
that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
G

Guest

I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory


Would that be right now. My Main Form is called Quotebuilder and no the
combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7
but it opens adobe along with a web page that crashes the internet. Is there
any way of being
able in finding out this subform container name? Please dont give up on me
now!

tina said:
comments inline.

tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take another look
at the RowSource property and correct it.
My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i know we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object, just like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that makes the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design view. on
the Toolbox toolbar, look for the button called Control Wizards (looks like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the control has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll understand it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the Properties box.
if you're using A2000 or newer, click on the subform control *twice*, and
the *subform object* is selected (instead of the subform control), and the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have the same
name as the subform object. if that's the case in your situation, it's not a
problem. (i usually make sure that my subform control has a different name
than the subform object it contains, to make it easier to tell the two apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control in the
form we've been working with. post back with the name, and i'll give you the
correct syntax for your combo box control's RowSource.

hth

tina said:
okay, what you didn't do was replace the names i gave that table and its'
fields, with the "real" names of those objects in your database. also, you
didn't say that you're using a subform; that makes a considerable difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested to the
record source of my second cboEquipName. Though now if have pasted it here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what you've
done
before i can tell you where you may have made a mistake. start by by
telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it
exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now
works
correctly (ace) but the second box is still blank, though it doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks
Lisa

:

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder than it is.
forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to select it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following
control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE
CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the
correct
names
of those fields in that table; you didn't mention the "real" names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to field
value
and
table named
"Category" (which is just a table that i created as a lookup table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
are
visible to select
a particular item, so that the user doesn't have to scroll through
a
massive
list.

I have looked at examples and the best code i could understand was
this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is
no
selection of
categories to choose from. When i go to that option and go to box
two
it
seems to be
an empty query or something with about 4 columns and a scroll bar
but
there
is no data
in it. Can someone please have a look and try to point me in the
right
direction. All
examples seem to be based on ID's = ID's but my table is only a
lookup
so
only has one text
column. IS this ok or do i have to have primary keys or unique
values
that
match?
Many Thanks to all of you that give advice to dim heads like me.
 
T

tina

in my last post, i gave you very detailed instructions on how to get the
correct subform control name. yet you responded by posting almost the
identical text as in your previous post, completely ignoring my answer. if
you're not willing to follow my directions and give me the control name i
asked for, then suggest you start a new thread and maybe somebody else will
work with you further.

hth


tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory


Would that be right now. My Main Form is called Quotebuilder and no the
combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7
but it opens adobe along with a web page that crashes the internet. Is there
any way of being
able in finding out this subform container name? Please dont give up on me
now!

tina said:
comments inline.

tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take another look
at the RowSource property and correct it.
My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i
know
we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object, just like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that makes the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design view. on
the Toolbox toolbar, look for the button called Control Wizards (looks like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the control has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll understand it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the Properties box.
if you're using A2000 or newer, click on the subform control *twice*, and
the *subform object* is selected (instead of the subform control), and the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have the same
name as the subform object. if that's the case in your situation, it's not a
problem. (i usually make sure that my subform control has a different name
than the subform object it contains, to make it easier to tell the two apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control in the
form we've been working with. post back with the name, and i'll give you the
correct syntax for your combo box control's RowSource.

hth

:

okay, what you didn't do was replace the names i gave that table and its'
fields, with the "real" names of those objects in your database.
also,
you
didn't say that you're using a subform; that makes a considerable difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


My tbl based on products is called Equipment Details, which has Equipment
Name and Category field names. I added the code that you suggested
to
the
record source of my second cboEquipName. Though now if have pasted
it
here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these
combo
boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what you've
done
before i can tell you where you may have made a mistake. start by by
telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post
the
SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it
exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now
works
correctly (ace) but the second box is still blank, though it doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks
Lisa

:

well, unless you're using the CboEquipName control to show multiple
different "lists", you're making this a whole lot harder
than it
is.
forget
everything you may already have set up, and just try the following:

open the form in Design view, and click on CboCategory to
select
it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following
control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE
CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the
correct
names
of those fields in that table; you didn't mention the "real" names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set
to
field
value
and
table named
"Category" (which is just a table that i created as a
lookup
table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
are
visible to select
a particular item, so that the user doesn't have to scroll through
a
massive
list.

I have looked at examples and the best code i could
understand
was
this
that
i entered
into the update event of cboCategory.

Me.CboCategory.RowSourceType = "Table/Query"
Me.CboEquipName.RowSource = "SELECT DISTINCT [" & _
Me.CboCategory & "] FROM [" & _
Me.CboEquipName.RowSource & _
"] ORDER BY [" & Me.CboCategory & "]"
End Sub

When i open the form and combo category it says just that,there is
no
selection of
categories to choose from. When i go to that option and go
to
box
two
it
seems to be
an empty query or something with about 4 columns and a
scroll
bar
but
there
is no data
in it. Can someone please have a look and try to point me
in
the
right
direction. All
examples seem to be based on ID's = ID's but my table is
only
a
lookup
so
only has one text
column. IS this ok or do i have to have primary keys or unique
values
that
match?
Many Thanks to all of you that give advice to dim heads
like
me.
 
G

Guest

I am sorry for not reading properly, Yes my table is called Equipment
details. But i cant make that link open without crashing the internet. How am
to find out what the container name can be.

tina said:
in my last post, i gave you very detailed instructions on how to get the
correct subform control name. yet you responded by posting almost the
identical text as in your previous post, completely ignoring my answer. if
you're not willing to follow my directions and give me the control name i
asked for, then suggest you start a new thread and maybe somebody else will
work with you further.

hth


tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory


Would that be right now. My Main Form is called Quotebuilder and no the
combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7
but it opens adobe along with a web page that crashes the internet. Is there
any way of being
able in finding out this subform container name? Please dont give up on me
now!

tina said:
comments inline.

I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take another look
at the RowSource property and correct it.


My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.

My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i know
we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object, just like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that makes the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design view. on
the Toolbox toolbar, look for the button called Control Wizards (looks like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the control has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll understand it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the Properties box.
if you're using A2000 or newer, click on the subform control *twice*, and
the *subform object* is selected (instead of the subform control), and the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have the same
name as the subform object. if that's the case in your situation, it's not a
problem. (i usually make sure that my subform control has a different name
than the subform object it contains, to make it easier to tell the two apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control in the
form we've been working with. post back with the name, and i'll give you the
correct syntax for your combo box control's RowSource.

hth



:

okay, what you didn't do was replace the names i gave that table and
its'
fields, with the "real" names of those objects in your database. also,
you
didn't say that you're using a subform; that makes a considerable
difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the
main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


My tbl based on products is called Equipment Details, which has
Equipment
Name and Category field names. I added the code that you suggested to
the
record source of my second cboEquipName. Though now if have pasted it
here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo
boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what
you've
done
before i can tell you where you may have made a mistake. start by by
telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the
SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it
exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now
works
correctly (ace) but the second box is still blank, though it
doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks
Lisa

:

well, unless you're using the CboEquipName control to show
multiple
different "lists", you're making this a whole lot harder than it
is.
forget
everything you may already have set up, and just try the
following:

open the form in Design view, and click on CboCategory to select
it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following
control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE
CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the
correct
names
of those fields in that table; you didn't mention the "real"
names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the
control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to
field
value
and
table named
"Category" (which is just a table that i created as a lookup
table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
 
T

tina

time for you to start a new thread. good luck with your project.


tboyce said:
I am sorry for not reading properly, Yes my table is called Equipment
details. But i cant make that link open without crashing the internet. How am
to find out what the container name can be.

tina said:
in my last post, i gave you very detailed instructions on how to get the
correct subform control name. yet you responded by posting almost the
identical text as in your previous post, completely ignoring my answer. if
you're not willing to follow my directions and give me the control name i
asked for, then suggest you start a new thread and maybe somebody else will
work with you further.

hth


tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory


Would that be right now. My Main Form is called Quotebuilder and no the
combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7
but it opens adobe along with a web page that crashes the internet. Is there
any way of being
able in finding out this subform container name? Please dont give up on me
now!

:

comments inline.

I have retyped the code so it reads like this. sorry for not
giving
better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take
another
look
at the RowSource property and correct it.


My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.

My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name
is.
I
could send it to you if you would like me too. Be patient with me
i
know
we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object,
just
like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that
makes
the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design
view.
on
the Toolbox toolbar, look for the button called Control Wizards
(looks
like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the
control
has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll
understand
it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the
Properties
box.
if you're using A2000 or newer, click on the subform control
*twice*,
and
the *subform object* is selected (instead of the subform control),
and
the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have
the
same
name as the subform object. if that's the case in your situation,
it's
not a
problem. (i usually make sure that my subform control has a
different
name
than the subform object it contains, to make it easier to tell the
two
apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control
in
the
form we've been working with. post back with the name, and i'll give
you
the
correct syntax for your combo box control's RowSource.

hth



:

okay, what you didn't do was replace the names i gave that table and
its'
fields, with the "real" names of those objects in your database. also,
you
didn't say that you're using a subform; that makes a considerable
difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the
main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click
on
the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


My tbl based on products is called Equipment Details, which has
Equipment
Name and Category field names. I added the code that you
suggested
to
the
record source of my second cboEquipName. Though now if have
pasted
it
here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo
boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what
you've
done
before i can tell you where you may have made a mistake.
start
by by
telling
me the *correct* name of your equipment table, and the names
of
the
equipment field and the category field in that table. then
post
the
SQL
statement that you put in cboEquipName's RowSource property.
do
a
copy/paste - DON'T type it out in the post, because i need
to
see it
exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first
combo
now
works
correctly (ace) but the second box is still blank, though it
doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks
Lisa

:

well, unless you're using the CboEquipName control to show
multiple
different "lists", you're making this a whole lot harder than it
is.
forget
everything you may already have set up, and just try the
following:

open the form in Design view, and click on CboCategory
to
select
it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following
control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE
CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment
with
the
correct
names
of those fields in that table; you didn't mention the "real"
names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the
control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its
set
to
field
value
and
table named
"Category" (which is just a table that i created as a lookup
table
for
my
"Equipment" input form.)

I wish to be able to select from the category list
which
then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
 
G

Guest

Thanks for trying, but remember we not all Db Experts when u post replies.

tina said:
in my last post, i gave you very detailed instructions on how to get the
correct subform control name. yet you responded by posting almost the
identical text as in your previous post, completely ignoring my answer. if
you're not willing to follow my directions and give me the control name i
asked for, then suggest you start a new thread and maybe somebody else will
work with you further.

hth


tboyce said:
I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory


Would that be right now. My Main Form is called Quotebuilder and no the
combo box isn't on this form
My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7
but it opens adobe along with a web page that crashes the internet. Is there
any way of being
able in finding out this subform container name? Please dont give up on me
now!

tina said:
comments inline.

I have retyped the code so it reads like this. sorry for not giving better
detail!

SELECT Equipment Name From tblEquipment Details Where Category =
Me!CboCategory

is your table really named "tblEquipment Details"? if not, take another look
at the RowSource property and correct it.


My Main Form is called Quotebuilder and no the combo box isn't on this
form

okay, then presumably it's on the subform.

My Sub Form is called Quote Details but the links on that link you sent
keeps making IE 7 crash out so i cant tell what the container name is. I
could send it to you if you would like me too. Be patient with me i know
we
close to getting it. Thank you

okay, we'll both exercise some patience, and i'll talk you through it as
well as i can. first some background: a subform is a form object, just like
a main form is a form object; both show in the Forms tab in the database
window. it's the placement of one form within a second form that makes the
first a subform - when it's being used from within the second form.

okay, now, make a copy of your database, so you can "play around" safely. do
all of the following in the copy:

create a new blank form and call it FormA. open the form in Design view. on
the Toolbox toolbar, look for the button called Control Wizards (looks like
a magic wand). make sure it is *not* selected. now look for the button
called Subform/Subreport. click it once and then click into the Detail
section of the form. you have just placed a subform "container" control
(usually just called a subform control) on the form. with the control
selected, look at the Name property in the Properties box. the control has a
default name, probably Child0. look at the SourceObject property; it's
blank. (put your cursor in that "line" and press F1; up comes the
SourceObject property in Access Help. read up on it so you'll understand it
better.) click on the "down" arrow at the right side of the "line", and
choose a form (any form) from the droplist.

now the form you chose is a subform, whenever you're using it from within
FormA. notice that the subform container control is named Child0 (or
whatever name Access gave it). you can change this name to anything you
want, the same way you can change the name of a textbox control, or a
command button, etc, etc.

now close FormA. open it again in Design view. if you click on the subform
control *once*, it is selected, and its' name shows in the Properties box.
if you're using A2000 or newer, click on the subform control *twice*, and
the *subform object* is selected (instead of the subform control), and the
subform name shows in the Properties box.

btw, if you add a subform to a form by dragging it from the database window,
or by using a wizard, then probably the subform control will have the same
name as the subform object. if that's the case in your situation, it's not a
problem. (i usually make sure that my subform control has a different name
than the subform object it contains, to make it easier to tell the two apart
when writing code, etc - but that's just my personal preference.)

okay, now you should be able to get the name of the subform control in the
form we've been working with. post back with the name, and i'll give you the
correct syntax for your combo box control's RowSource.

hth



:

okay, what you didn't do was replace the names i gave that table and
its'
fields, with the "real" names of those objects in your database. also,
you
didn't say that you're using a subform; that makes a considerable
difference
in the control reference used as the criteria.

what is the name of your main form?
what is the name of the subform "container" control that sits on the
main
form?
(if you don't know the difference between a subform object and its'
container control, go to
http://home.att.net/~california.db/instructions.html and click on the
SubformControlName link.)
is CboCategory sitting on the main form, or on the subform?

hth


My tbl based on products is called Equipment Details, which has
Equipment
Name and Category field names. I added the code that you suggested to
the
record source of my second cboEquipName. Though now if have pasted it
here
it
reads like this now.
SELECT EquipName AS Expr1 FROM tblEquipment AS Details WHERE
((([Category])=Forms![Quote Details]!CboCategory));

The Quote Details form is the name of the sub form that these combo
boxes
are stored


:

i can't see your database, Lisa, so you'll have to tell me what
you've
done
before i can tell you where you may have made a mistake. start by by
telling
me the *correct* name of your equipment table, and the names of the
equipment field and the category field in that table. then post the
SQL
statement that you put in cboEquipName's RowSource property. do a
copy/paste - DON'T type it out in the post, because i need to see it
exactly
as it is in the property.

hth


Thank you for helping me. I done all that and the first combo now
works
correctly (ace) but the second box is still blank, though it
doesn't
like
like an empty query anymore. What Have i not done correctly.Thanks
Lisa

:

well, unless you're using the CboEquipName control to show
multiple
different "lists", you're making this a whole lot harder than it
is.
forget
everything you may already have set up, and just try the
following:

open the form in Design view, and click on CboCategory to select
it.
set
the
following control properties, as

ControlSource: <leave it blank>
RowSourceType: Table/Query
RowSource: Category
(that's the table name you posted)
ColumnCount: 1
ColumnWidths: 1"
(you can change this to be as wide or narrow as you need)
BoundColumn: 1
LimitToList: Yes

next, click on CboEquipName to select it, and set the following
control
properties, as

ControlSource: <the name of the equipment field in the table
that's
bound
to the form>
RowSourceType: Table/Query
RowSource: SELECT EquipmentName FROM tblEquipment WHERE
CategoryName =
Forms!FormName!CboCategory;
(replace EquipmentName, CategoryName and tblEquipment with the
correct
names
of those fields in that table; you didn't mention the "real"
names
in
your
post)
ColumnCount: 1
ColumnWidths: 1"
(again, change the width to suit)
BoundColumn: 1
LimitToList: Yes

go back to CboCategory and add the following code to the
control's
AfterUpdate event procedure (replacing any other code in that
procedure), as

Me!CboEquipName.Requery

hth


I have a combo box cboCategory that is unbound, its set to
field
value
and
table named
"Category" (which is just a table that i created as a lookup
table
for
my
"Equipment" input form.)

I wish to be able to select from the category list which then
filters
my
second combo
cboEquipName so that only the products that fall into that
category
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top