Solved

Can you have a IIF(IsDate together?

Posted on 2008-10-12
3
293 Views
Last Modified: 2012-06-27
I have a variable that would either be blank or have a date and the variable name is VdtmResponse

The code is written like

testoutput = iif(IsDate(VdtmResponse), 1, 2)

But I get the following error...

Type mismatch: 'iif'

Any ideas?
0
Comment
Question by:Zantis
[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
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 22696672
Are you doing this on vb or on a sql statement? IIF is NOT a vb contruct. It works on db only.

Dim testoutput
testoutput=2
If Trim(VdtmResponse)<>"" Then
testoutput=1
End
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 22696674
IIF is not available in vbscript, you need to have a customize function, like this:

<%

function IIF(cond, v1, v2)
    if cond then
          IIF = v1
    else
         IIF = v2
   end if
end function
%>

then:


testoutput = iif(IsDate(VdtmResponse), 1, 2)
0
 
LVL 6

Expert Comment

by:carlsiy
ID: 22696828
testoutput = iif(IsDate(VdtmResponse)=True, 1, 2)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
innerHTML 7 46
Html Table looping 4 42
asp classic find word in string and get its value 7 50
Two decimal 5 43
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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