Hi,
I'm trying to write a formula that will return the first part of a postcode (since there could be 2-4 characters here, I have to drop the last three then use trim to get rid of gaps). There are some null values in the results, but when using what I currently have or IIF to get rid of the Null values, the OBDC link that I'm trying to generate in excel returns the error message: [Microsoft][OBDC Microsoft Access Driver] Invalid Procedure Call
I can't use NZ as this doesn't work in excel. I also get the 'Invalid Procedure Call' in a later query but not in the one below where the error is being caused:
SELECT [MIV Prep Query].[Unique ID], [MIV Prep Query].[Order Number], [MIV Prep Query].[Order Type], [MIV Prep Query].[Customer Account Number], [MIV Prep Query].[Customer name] AS [Customer Name], [MIV Prep Query].[Customer Reference], [MIV Prep Query].Postcode, Trim(Mid([Postcode],1,Len([Postcode])-3)) AS [Part Postcode], "" AS Branch, CarPlus_MIV.MIV AS [Add'n Detail], IIf(IsNull([MIV]),"Other","MIV") AS Type, [MIV Prep Query].Date
FROM [MIV Prep Query] LEFT JOIN CarPlus_MIV ON [MIV Prep Query].[MIV ID] = CarPlus_MIV.[Unique ID];
Any idea where I'm going wrong? It definitely seems to be to do with "Trim(Mid([Postcode],1,Len([Postcode])-3)) AS [Part Postcode]" as when I take this out, everything works ok.
Thanks in advance!
I'm trying to write a formula that will return the first part of a postcode (since there could be 2-4 characters here, I have to drop the last three then use trim to get rid of gaps). There are some null values in the results, but when using what I currently have or IIF to get rid of the Null values, the OBDC link that I'm trying to generate in excel returns the error message: [Microsoft][OBDC Microsoft Access Driver] Invalid Procedure Call
I can't use NZ as this doesn't work in excel. I also get the 'Invalid Procedure Call' in a later query but not in the one below where the error is being caused:
SELECT [MIV Prep Query].[Unique ID], [MIV Prep Query].[Order Number], [MIV Prep Query].[Order Type], [MIV Prep Query].[Customer Account Number], [MIV Prep Query].[Customer name] AS [Customer Name], [MIV Prep Query].[Customer Reference], [MIV Prep Query].Postcode, Trim(Mid([Postcode],1,Len([Postcode])-3)) AS [Part Postcode], "" AS Branch, CarPlus_MIV.MIV AS [Add'n Detail], IIf(IsNull([MIV]),"Other","MIV") AS Type, [MIV Prep Query].Date
FROM [MIV Prep Query] LEFT JOIN CarPlus_MIV ON [MIV Prep Query].[MIV ID] = CarPlus_MIV.[Unique ID];
Any idea where I'm going wrong? It definitely seems to be to do with "Trim(Mid([Postcode],1,Len([Postcode])-3)) AS [Part Postcode]" as when I take this out, everything works ok.
Thanks in advance!