Solved

Can you have a IIF(IsDate together?

Posted on 2008-10-12
3
277 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
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 49

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

9 Experts available now in Live!

Get 1:1 Help Now