Hi David,
A good programming practice is to rename controls from the generic names
that MS provides to a more descriptive name. Which tells you more:
Combo185
and Combo186.Value or cboDepartment and cboJobType??
Value is the default property for (most) controls; it is not necessary to
type it.
this works DoCmd.ApplyFilter , "" & Combo185.Value & " = " &
Combo186.Value & ""
You have empty string concantated with the value of Combo185, concantated
with the string " = ", concantated with the value of Combo186.
If Combo185 = 5 and Combo186 = 5 then your filter would read
DoCmd.ApplyFilter , 5 = 5 (ie TRUE)
this works DoCmd.ApplyFilter , "[val_pass] = 1"
This is normal. You have a field name compared to a value.
DoCmd.ApplyFilter , "" & Combo185.Value & " = " & Combo186.Value & ""
And
"[val_pass] = 1"
This one is an empty string concantated with the value of Combo185,
concantated with the string " = ", concantated with the value of
Combo186,
concantated with the string [val_pass] = 1. Here the big error is the
word
AND is not within quotes.
You *could* try:
DoCmd.ApplyFilter , Combo185 & " = " & Combo186 & " And [val_pass] = 1"
It all depends on what Combo185 and Combo186 are.
A typical filter might be:
DoCmd.ApplyFilter , "[SomeFieldName] " = " & Combo186 & " And [val_pass]
=
1"
where the field type of [SomeFieldName] is a number. If the field type
of
[SomeFieldName] is text the filter might look like:
DoCmd.ApplyFilter , "[SomeFieldName] '" = " & Combo186 & "' And
[val_pass]
= 1"
Expanded, it looks like
"[SomeFieldName] ' " = " & Combo186 & " ' And [val_pass] = 1"
If Combo186 data type is Date/Time, then the delimiters are the hash mark
(#):
DoCmd.ApplyFilter , "[SomeFieldName] #" = " & Combo186 & "# And
[val_pass]
= 1"
If you post the names of the fields you want to filter on and the field
data
types, it would be easier to help you with the filter string.
HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
Haggis said:
Hello all,
relative novice to Access coding ...bear with me
this works DoCmd.ApplyFilter , "" & Combo185.Value & " = " &
Combo186.Value & ""
this works DoCmd.ApplyFilter , "[val_pass] = 1"
this does not ...
DoCmd.ApplyFilter , "" & Combo185.Value & " = " & Combo186.Value & ""
And
"[val_pass] = 1"
I am trying to 2 to 3 filters at once on a form.
thanks for any thoughts!!