Records not appearing in query

Slab_Rankle

Registered User.
Local time
Today, 11:49
Joined
Aug 10, 2011
Messages
36
Hey guys,

I'm having an issue with one of my queries. Basically I'm trying to create a performance report that uses the following fields:

Filterer (Text)
Advisor (Text)
LeadSource (Text)

Now, the process is as follows: When a client phones in, the filterer enters them onto our system. Sometimes the client will be passed onto an advisor, sometimes they wont. This means that fairly often only the filterer and lead source fields will be filled in. Now, I've got some criteria on these fields that prompts the user to enter the name of the filterer, the name of the advisor and the lead source. I want it so that when the filterer name and lead source are filled in it will show ALL records with the filterers name from that lead source, even if no advisor has been specified. Here's my current SQL:

SELECT [Basic Details].Filterer, [Basic Details].Advisor, [Basic Details].LeadSource, Count([Basic Details].Filterer) AS CountOfFilterer, Count([Basic Details].Advisor) AS CountOfAdvisor, Sum(IIf([Filterer]=[Advisor],1,0)) AS SelfGen
FROM [Basic Details]
GROUP BY [Basic Details].Filterer, [Basic Details].Advisor, [Basic Details].LeadSource
HAVING ((([Basic Details].Filterer) Like "*" & [Enter an Filterer] & "*") AND (([Basic Details].Advisor) Like "*" & [Enter an Advisor] & "*") AND (([Basic Details].LeadSource) Like "*" & [Enter a Broker] & "*"));

Now, this works, but it doesn't display any entries where Advisor is left blank. How do I stop this from happening?
 
Perfect! That's exactly what was happening to me. Thanks for helping :)
 

Users who are viewing this thread

Back
Top Bottom