Combo Selection

  • Thread starter Thread starter Missy
  • Start date Start date
M

Missy

I want to be able to pull data on a subform by multiple
cbo's. If I select cbo 1, it gives everything equal to
that. If I select cbo 1 and cbo 2, it gives everything
equal to the both. If I select cbo 1, cbo 2, and cbo 3,
it does the same. Very new to this and have a little
code - just not working. It is possible that someone
could provide an example code for me to go by. I also
would like to see ALL records in the subform if I don't
select anything. I really need help. Thanks in advance
for anyone's assistance.
 
Missy said:
I want to be able to pull data on a subform by multiple
cbo's. If I select cbo 1, it gives everything equal to
that. If I select cbo 1 and cbo 2, it gives everything
equal to the both. If I select cbo 1, cbo 2, and cbo 3,
it does the same. Very new to this and have a little
code - just not working. It is possible that someone
could provide an example code for me to go by. I also
would like to see ALL records in the subform if I don't
select anything. I really need help. Thanks in advance
for anyone's assistance.

Try the following:
me!subform_name.recordsource= "SELECT field1, field2, field3, field4, field
5, field6" _
& "FROM tablename " _
& "WHERE (field1 = " & cbo1.value & " OR ISNULL(" & cbo1.value & ") AND " _
& "(field2 = " & cbo2.value & " OR ISNULL(" & cbo2.value & ") AND " _
& "(field3 = " & cbo3.value & " OR ISNULL(" & cbo3.value & ") ;"

Good Luck!

Alden

Please reply to the newsgroup.
 
Back
Top