Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > If Then

Reply
Thread Tools

If Then

 
 
paulmitchell507
Guest
Posts: n/a
 
      09-03-2008
I am designing a small .asp (classic) application, I am connecting to
a Access 2k database via ADO to retrieve data. I have a number
variable's that contain text that is posted from a previous screen

AMPM = Request.Form("AMPM")
AMPMDate = Request.Form("AMPMDate")
halfday = "(" & AMPM & "," & AMPMDate & ")"

I then compose a CDOSYS email and send the value of the variable in
the .HTML body of the email

..HTML = "Number of Days" & halfday

What I would like to do is only display the value of the halfday
variable if it contains a value. I was thinking along the lines of

If halfday = Null Then
halfday = ""

Else

halfday = halfday

End if

I know this does not work, but it gives an idea of what I am trying to
achieve.
Any help would be appreciated.

Regards

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      09-03-2008
paulmitchell507 wrote:
> I am designing a small .asp (classic) application, I am connecting to
> a Access 2k database via ADO to retrieve data. I have a number
> variable's that contain text that is posted from a previous screen
>
> AMPM = Request.Form("AMPM")
> AMPMDate = Request.Form("AMPMDate")
> halfday = "(" & AMPM & "," & AMPMDate & ")"
>
> I then compose a CDOSYS email and send the value of the variable in
> the .HTML body of the email
>
> .HTML = "Number of Days" & halfday
>
> What I would like to do is only display the value of the halfday
> variable if it contains a value. I was thinking along the lines of
>
> If halfday = Null Then


This will never be true. Comparisons to Null always result in Null. You
probably mean:

If halfday Is Null Then

However, this will also never be the case at this point because in your
previous statements, you assigned values to halfday. I think what you
intend to do is something like;

If AMPM = "" And AMPMDate = "" then
halfday=""
Else
halfday = "(" & AMPM & "," & AMPMDate & ")"
End if


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      09-04-2008
"Bob Barrows [MVP]" <> wrote in message
news:...
> paulmitchell507 wrote:
>> I am designing a small .asp (classic) application, I am connecting to
>> a Access 2k database via ADO to retrieve data. I have a number
>> variable's that contain text that is posted from a previous screen
>>
>> AMPM = Request.Form("AMPM")
>> AMPMDate = Request.Form("AMPMDate")
>> halfday = "(" & AMPM & "," & AMPMDate & ")"
>>
>> I then compose a CDOSYS email and send the value of the variable in
>> the .HTML body of the email
>>
>> .HTML = "Number of Days" & halfday
>>
>> What I would like to do is only display the value of the halfday
>> variable if it contains a value. I was thinking along the lines of
>>
>> If halfday = Null Then

>
> This will never be true. Comparisons to Null always result in Null. You
> probably mean:
>
> If halfday Is Null Then
>


Your VBScript getting a bit rusty Bob?

If IsNull(halfday) Then

The Is keyword in VBScript tests the type of an object (via the
QueryInterface method).

--
Anthony Jones - MVP ASP/ASP.NET



 
Reply With Quote
 
paulmitchell507
Guest
Posts: n/a
 
      09-04-2008
On Sep 4, 9:08*am, "Anthony Jones" <AnthonyWJo...@yadayadayada.com>
wrote:
> "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom> wrote in messagenews:. ..
>
>
>
>
>
> > paulmitchell507 wrote:
> >> I am designing a small .asp (classic) application, I am connecting to
> >> a Access 2k database via ADO to retrieve data. *I have a number
> >> variable's that contain text that is posted from a previous screen

>
> >> AMPM = Request.Form("AMPM")
> >> AMPMDate = Request.Form("AMPMDate")
> >> halfday = "(" & AMPM & "," & AMPMDate & ")"

>
> >> I then compose a CDOSYS email and send the value of the variable in
> >> the .HTML body of the email

>
> >> .HTML = "Number of Days" & halfday

>
> >> What I would like to do is only display the value of the halfday
> >> variable if it contains a value. *I was thinking along the lines of

>
> >> If halfday = Null Then

>
> > This will never be true. Comparisons to Null always result in Null. You
> > probably mean:

>
> > If halfday Is Null Then

>
> Your VBScript getting a bit rusty Bob?
>
> If IsNull(halfday) Then
>
> The Is keyword in VBScript tests the type of an object (via the
> QueryInterface method).
>
> --
> Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> - Show quoted text -


Bob's VBScript may/may not be a bit rusty (I am not qualified to
judge, hence my question) but it worked for me!
Thank you both very much for your help.
 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      09-04-2008
Anthony Jones wrote:
>>> What I would like to do is only display the value of the halfday
>>> variable if it contains a value. I was thinking along the lines of
>>>
>>> If halfday = Null Then

>>
>> This will never be true. Comparisons to Null always result in Null.
>> You probably mean:
>>
>> If halfday Is Null Then
>>

>
> Your VBScript getting a bit rusty Bob?
>
> If IsNull(halfday) Then
>
> The Is keyword in VBScript tests the type of an object (via the
> QueryInterface method).


Oops. Doing too much sql lately ...

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow, then quick then slow JosephByrns ASP .Net 4 11-13-2007 01:34 AM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
Read all of this to understand how it works. then check around on otherRead all of this to understand how it works. then check around on other thelisa martin Computer Support 2 08-18-2005 06:40 AM
greater then / less then =?Utf-8?B?TWlrZQ==?= ASP .Net 2 11-04-2004 06:05 PM
Help: anyway to burn movie to DVD RW (then view it) and then eraseafterward? qwerty DVD Video 6 01-07-2004 04:54 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57