Solved

Can you have a IIF(IsDate together?

Posted on 2008-10-12
3
288 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 51

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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