Solved

IIF statement issue VB.net

Posted on 2004-10-02
3
916 Views
Last Modified: 2006-11-17
hi experts, i am having an issue with using the IIF statement to an access db from my vb.net application
here is my code and the error i get.
this one really has me stumped as far as i can tell my syntax is correct.
i have tried simple iif statements and they all fail on the '<=>' argument

SELECT IIf(A.ASSIGN_DT>A.EXP_DT,DateDiff('d',A.ASSIGN_DT,Now()),DateDiff('d',A.EXP_DT,Now())) AS AGE, A.CASE_ID, A.CASE_TYPE, A.INSURED, A.INS_DBA, A.ASSIGN_DT, A.EXP_DT, A.SENT_DT, A.REP_DUE_DT,
                      A.CASE_READ, A.CON_CITY, A.INS_PHONE, B.STAT_COMMENTS AS Scheduled, B.STATUS_DESC AS Description
FROM         (SELECT     dattbl_Case.CASE_ID, dattbl_Case.CASE_TYPE, dattbl_Case.INSURED, dattbl_Case.INS_DBA, dattbl_Case.ASSIGN_DT,
                                              dattbl_Case.REP_DUE_DT, dattbl_Case.EXP_DT, dattbl_Tracker.CASE_READ, dattbl_Tracker.SENT_DT, dattbl_Case.CON_CITY,
                                              dattbl_Case.INS_PHONE
                       FROM          dattbl_Case INNER JOIN
                                              dattbl_Tracker ON dattbl_Case.CASE_ID = dattbl_Tracker.CASE_ID
                       WHERE      (dattbl_Tracker.FOLDER = 'INBOX')) A LEFT OUTER JOIN
                          (SELECT     CASE_ID, STAT_CODE, STAT_COMMENTS, STAT_ID, STAT_NEXT_DT, STATUS_DESC
                            FROM          dattbl_Status
                            WHERE      (STAT_CODE = 78 OR
                                                   STAT_CODE = 79 OR
                                                   STAT_CODE = 80 OR
                                                   STAT_CODE = 81)) B ON A.CASE_ID = B.CASE_ID

Error in list of function arguments: '>' not recognized.
Unable to parse query text.
0
Comment
Question by:DTRON04
3 Comments
 
LVL 34

Accepted Solution

by:
flavo earned 500 total points
ID: 12209790
hmmm.. not too sure but

Iif will return an object, and although your statement would have worked in VB 6.0 (id dare say) .Net is strongly typed and maybe this was the casue of the problem, so..

CType(IIf(A.ASSIGN_DT>A.EXP_DT,DateDiff('d',A.ASSIGN_DT,Now()),DateDiff('d',A.EXP_DT,Now())), Date)..

May also need to do it to cType(A.ASSIGN_DT,Date)>ctype(A.EXP_DT,date)

Dave
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now