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