Let me get this straight.
Listbox_1 contains a list of the fields existing in a specific table. No
doubt, it's RowSourceType property = Field List.
When you click a fieldname in Listbox_1, you probably have code which
populates Listbox_2 with (what I presume to be) a distinct list of values
that are present in the field selected in Listbox_1. In that case, you're
probably using the following SQL statement to set Combobox's RowSource
property:
strSQL = "SELECT DISTINCT [" & Me.Listbox_1 & "] FROM tblMyTable"
Then, when you select a value from Combobox, you have code which
populates
Listbox_2 with a bunch of records (or a subset thereof) from the table
where
the selected field contains the value selected in Combobox. I'm guessing
you
have code similar to the following:
strSQL = "SELECT * FROM tblMyTable WHERE [" & Me.Listbox_1 & "] = """
&
Me.Combobox & """"
....and you're wondering why you can't return values which are from a
Yes/No
(Boolean) datatype field.
If all this is correct, then you need to change the last SQL statement so
it
always returns a string value:
strSQL = "SELECT * FROM tblMyTable WHERE CStr([" & Me.Listbox_1 & "])
=
""" & Me.Combobox & """"
But I don't know how you managed to get the words "Yes" and "No" into
Combobox. Explain that, and we should be about done.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
BIGRED56 said:
OK so this is what it is..
1)Listbox_1
2)Combobox
3)Listbox_2
-Listbox_1 is a list that displays all fields names in my table
-Combobox is the prompted to display certain values, based on which
field
is
chosen
-After the value is chosen it then filters Listbox_2 to output which
records
have the designated value in the designated field
-My problem is that I have check box fields in the firstlist box also
with
many other fields that are text based..What I cant get to work is for
ListBox_2 to prompt record results. List_1 and The combo box bring up
the
right value and field..
:
:
I don't follow what you're trying to do here. You say you have a field
which
is based on a yes/no field, yet you're trying to match a string
pattern,
using a wildcard no less. Show me the entire SQL statement.
I think if you're trying to match a yes/no field in the query, based
on
what
the user selects from the combo, then here's what you should do:
1. Change combo61's properties as follows:
RowSource: Yes;-1;No;0
ColumnCount: 2
BoundColumn: 2
ColumnWidths: 1cm;0cm (or the imperial equivalent)
2. Change the query as follows:
Me.List4.RowSource = "Select.....From...Where ...." &
me.combo61
Unless there's something else I don't know about your scenario, the
above
should work.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
thank you Graham code makes sense but my program is a lil diffferent
Ok so the first list(59) is wher i display fields
-coding for field:
select Case Me.list59
Case Is = "Changed Drive End Brgs"
strRowSourceList2 = "True;False"
end select
Me.Combo61.RowSource = strRowSourceList2
Now Combo61 is the combo box that is storing values
Coding to display the records in the other record display list
box(List4)
-select Case Me.list59
Case Is = "Changed Drive End Brgs"
Me.List4.RowSource = "Select.....From...Where ....'*" & me.combo61 &
"*'"
But when this is done nothing happens..All the feild that are not
checklists
work
-I even went to my table and changed the format to True and False.
THANKS for the feedback but I am alittle bit still confused can you
hellp
me
a little more Graham
:
Instead of using the words "yes" or "no", use the keywords "True"
or
"False"
respectively, or the numbers -1 or 0.
The following examples check for "yes":
If Me.chkCheckbox1 = True Then
....or...
If Me.chkCheckbox1 = -1 Then
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
Hi all I have a problem...
-I have a list box(List59) with fields from my table(NamePlate)
-This list box is connected to a combo box(Combo61)( which
displays
the
certain values based on which feild is chosen from the list
box)...
These
values were manually written into the code as a VALUE LIST
-I then Place code into the combo box(combo61) change function to
display
records into another list(List4)...This all works well until I
have
a
feild
which is based on yes/no check box type.
-I can select the field from the first text box then display yes
or
no
into
the combo box, but on the final list box which is for displaying
records
it
shows up blank..
-What my question is , is that "yes/ no" are they the right
values I
want
to
impliment into my ValueList