In another thread you posted what you idenitifed as After Update code. I
pointed out that there was no After Update code, so nothing would happen
when selecting from the combo box. A response from you would have shown
that you understand (or not) why selecting from the combo box could not
accomplish anything. You posted command button code that may work to filter
the records provided that both combo boxes contain a selection, and that
neither contains (All). However, you did not respond to my observation that
selecting (All) and clicking the command button will produce no results,
given the command botton code as posted. I also suggested that you verify
the string being produced by the code. The Debug.Print line of code would
have accomplished that.
These are the sorts of things to which I referred. Following the suggestion
to verify the filter string it would have been helpful to know if you had
done so and what you had discovered. That new information would have helped
narrow down the problem, which would have increased the chances of finding a
solution.
I'm not trying to take you to task for newsgroup etiquette, but rather
pointing out that a careful reading of and effort to implement posted
suggestions can lead to a solution. Even if you tried the suggestions, a
brief response that makes no mention of that is somewhat unlikely to draw
further responses and suggestions, at least no in depth.
NukeEng85 said:
Bruce,
Thank you for your suggestion, I will try to be more clear with my
responses
concerning problems I'm having with the codes. I actually have been
continuously checking all the threads I have started, and I tried what
both
yourself and Douglas Steele suggested, and was still having problems. I
have
since then figured out a different way to produce the same results, which
is
why I didn't respond.
As far as providing more details, I'm not sure what other details people
need as I have posted the Macro code multiple times, and all of the event
builder and query information I have. If there is something I'm not
including I would really appreciate your input because I am trying to do
what
I can to help the people who are being so kind as to help me. What should
I
respond when I try something that someone suggests and I get no results?
I'm
obviously not very in-tune with the posting etiquette, thank you for your
assistance.
BruceM said:
This is just some thoughts about newsgroup postings. In this thread you
asked a question, then without waiting for an answer proceeded to the
conclusion that the suggestion doesn't work. The comment that the code
is
not right "if one of the combos is not set" probably means that if one of
the combo boxes is null or does not contain a valid item the code will
not
work.
In another thread you responded to a suggestion with what strikes me as a
somewhat dismissive "I did what you said, and still no results, thank you
for trying." You have now apparently abandoned that thread. However,
the
suggestion made in that thread by Douglas Steele will work, but you did
not
respond to the request for further details. My suggestion in that thread
would have worked too, but again details about your database were
missing.
If for whatever reason you choose not to follow through on a suggested
course of action that is your choice, but please do not hurry to the
conclusion that the problem is with the suggestion, especially if you do
not
respond to requests for clarification.
For best results, be specific about error messages or the exact nature of
the failure. Responses such as "It did not work" are too vague.
Also, I tried using your code, and I still have to manually set the
filters
with the toolbar buttons for it to work. Thanks anyways!
:
strWhere = strWhere & "([SNM TYPE] = """ & Me.Combo22 & """)
AND "
Is snm type a number type field, or text type field. (you have to
check
in
the table desing view to be sure). I also perfer the user of single
quotes
as it bit less " plahing.
eg:
strWhere = strWhere & "([SNM TYPE] = '" & Me.Combo22 & "' AND "
Also, code is not quite right for if one of the combos is not set.
Try:
If Not IsNull(Me.Combo22) Then
strWhere = "([SNM TYPE] = '" & Me.Combo22 & "')"
End If
If Not IsNull(Me.Combo24) Then
if strWhere <> "" then
strWhere = strWhere & " and "
end if
strWhere = strWhere & "([ICA] = '" & Me.Combo24 & "')"
End If
if strWhere = "" then
MsgBox "No criteria, all data will show", vbInformation, "Nothing
to
do."
end if
debug.print strWhere
me.Filter = strwhere
me.FilterOn = true
Note how the 2nd conditaiton of code is desinged to "add" to the
previoues
codndin. yOu cna contineu that same block of code for as many
additonal
contorls onthe frm. And, if none of the ocntorls are filled..then
stWhere
will = blank.
Also, after the above code runs, take a look at the debug.print of the
strWhere...does it look correct?
So, remember, if ica, or snm type are number fields, then your code
looks
like:
strWhere = strWhere & "([ICA] = " & Me.Combo24 & ")"