Solved

How to resolve an error in an Access 2003 query expression:  Function is not available in expressions in query expression 'IIf(isnumeric (clientacct),left(clientacct,3),"")'.  ?

Posted on 2013-12-30
4
837 Views
Last Modified: 2014-01-08
I am working with an Access 2003 application and when I execute the following query,
I get the error:

Function is not available in expressions in query expression 'IIf(isnumeric (clientacct),
left(clientacct,3),"")'.

Do you know how I can resolve this error?

INSERT INTO tblOpenItems
( Bank, Office, checkNum, refNo, [trans date], Type, [process date], Pending, AgeDays, T, Description,
amount, UserID, AuditDate, footnote, responsibility, rptID, [REPORT NAME] )
SELECT
OI_WRS.bankNum,
IIf(isnumeric(clientacct),left(clientacct,3),""),
IIf(isnumeric(clientacct),right(clientacct,6),clientacct),
OI_WRS.refNum,
OI_WRS.transMnth & "/" & OI_WRS.transDay & "/" & OI_WRS.transYr,
OI_WRS.transType,
OI_WRS.procMnth & "/" & OI_WRS.procDay & "/" & OI_WRS.processYr,
OI_WRS.pending,
OI_WRS.age*1,
OI_WRS.cr_db,
OI_WRS.descr,
IIf(sign="-",CDbl(OI_WRS.amount*(-1)/100),CDbl(amount)/100),
OI_WRS.userID,
OI_WRS.auditDt,
" ",
" ",
tblBanks.rptID,
tblBanks.[REPORT NAME]
FROM OI_WRS INNER JOIN tblBanks ON OI_WRS.bankNum=tblBanks.[Bank Code];
0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39747424
A couple of things I would check to start with.

1.  Check your references and ensure that none of them are MISSING.
2.  Does the [ClientAcct] field contain data for all fields, are there any NULLs?
3.  Are the fields [Trans date] and [Process date] actually date fields, or are they strings?  the way your SQL is written, it looks like they are strings.  If they are actually dates, you might want to try replacing:

OI_WRS.transMnth & "/" & OI_WRS.transDay & "/" & OI_WRS.transYr,

with:

DateSerial(OI_WRS.TransYr, OI_WRS.TransMnth, OI_WRS.TransDay)

and thendo the same for process month.

4.  I assume you are using Access as the front-end and are connecting to a Sybase database via ODBC, is that correct?  Are you running this query directly from Access or are you running it as a pass-through query to Sybase?

5.  What is "sign" in this line of code?

IIf(sign="-",CDbl(OI_WRS.amount*(-1)/100),CDbl(amount)/100)

is it a variable?  If so, where do you think that value is coming from?  In Access, there is a function sgn( ) which will return the sign associated with a value like sgn([somenumericfield]),  so is that a Sybase function?  If so, it will not be available in Access.
0
 

Author Comment

by:zimmer9
ID: 39747538
To answer you second point, yes the [ClientAcct] field contains NULL values for some records.

If I replace the following 2 lines:

IIf(isnumeric(clientacct),left(clientacct,3),""),
IIf(isnumeric(clientacct),right(clientacct,6),clientacct),

with the next 2 lines

" ",
" ",

then the statement works fine.

How would you handle the possibilty of NULL values for the 2 IIf statements shown above?
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 250 total points
ID: 39748034
I could not tell you what is wrong.  That syntax works just fine in a sample table that I built.  That is why I asked all of the other questions.  If you would answer them, we might be able to figure it out.

Did you check your references?

IIf(isnumeric(clientacct & ""),left(clientacct & "",3),""),
IIf(isnumeric(clientacct & ""),right(clientacct & "",6), clientacct),
0
 
LVL 13

Assisted Solution

by:alpmoon
alpmoon earned 250 total points
ID: 39748269
First of all are you running that insert statement against Access database or Sybase database?

Sybase doesn't have that function. You need to replace it something else depending of Sybase product and version you are using if you need to execute that insert against a Sybase db.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question