Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search query not displaying record with null value

Status
Not open for further replies.

MA04

Technical User
Dec 21, 2004
162
GB
Hi,

I have a problem with my search query it does not seem to dispaly a record that has a null value in the SubString field below even though there is a value in the other fields, does anyone have any ideas why this may be the case?

THIS IS MY SEARCH QUERY:

SELECT I1.postcode, IIF(IsNull(Mid$(';' & I1.PRMF & ';',S1.num+1,S2.num-S1.num-1)), [I1].[Strd], (Mid$(';' & I1.PRMF & ';',S1.num+1,S2.num-S1.num-1)) & IIF(IsNull([Strd]),'',', ' & [Strd]) & IIF(IsNull([STR]),'',', ' & [STR])) AS SubString, IIF(IsNull([I1].[Locdd]),[I1].[Locd],[I1].[Locdd] & IIf(IsNull([Locd]),"",", " & [Locd])) AS Expr, IIF(IsNull([I1].[PTN]),[I1].[CNT],[I1].[PTN] & IIf(IsNull([CNT]),"",", " & [CNT])) AS Expr2
FROM ma_dbo_uk AS I1, integers AS S1, integers AS S2
WHERE (((I1.postcode) Like [Enter Postcode:]) AND ((Mid$(";" & [I1].[PRMF] & ";",[S1].[num],1))=';') AND ((Mid$(";" & [I1].[PRMF] & ";",[S2].[num],1))=';') AND (([S1].[num]+1)<[S2].[num]) AND ((InStr(1,Mid$(";" & [I1].[PRMF] & ";",[S1].[num]+1,[S2].[num]-[S1].[num]-1),";"))=0));

Thanks in advance,

M-.
 
I think the problem lays within the Where condition of the sql statement, the condition states that the postcode AND (keyword) the split field have to meet but what i want is all the ones with a postcode. I was wondering if i could put an IIF statement around that split field code, any suggestions,

Thanks in advance,

M-.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top