Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old September 3rd, 2008, 03:15 PM
paulmitchell507
Guest
 
Posts: n/a
Default If Then

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

  #2  
Old September 3rd, 2008, 03:55 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: If Then

paulmitchell507 wrote:
Quote:
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.


  #3  
Old September 4th, 2008, 09:15 AM
Anthony Jones
Guest
 
Posts: n/a
Default Re: If Then

"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcomwrote in message
news:uzdFJRdDJHA.3432@TK2MSFTNGP05.phx.gbl...
Quote:
paulmitchell507 wrote:
Quote:
>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



  #4  
Old September 4th, 2008, 11:45 AM
paulmitchell507
Guest
 
Posts: n/a
Default Re: If Then

On Sep 4, 9:08*am, "Anthony Jones" <AnthonyWJo...@yadayadayada.com>
wrote:
Quote:
"Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcomwrote in messagenews:uzdFJRdDJHA.3432@TK2MSFTNGP05.phx.gbl. ..
>
>
>
>
>
Quote:
paulmitchell507 wrote:
Quote:
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
>
Quote:
Quote:
AMPM = Request.Form("AMPM")
AMPMDate = Request.Form("AMPMDate")
halfday = "(" & AMPM & "," & AMPMDate & ")"
>
Quote:
Quote:
I then compose a CDOSYS email and send the value of the variable in
the .HTML body of the email
>
Quote:
Quote:
.HTML = "Number of Days" & halfday
>
Quote:
Quote:
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
>
Quote:
Quote:
If halfday = Null Then
>
Quote:
This will never be true. Comparisons to Null always result in Null. You
probably mean:
>
Quote:
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.
  #5  
Old September 4th, 2008, 12:05 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: If Then

Anthony Jones wrote:
Quote:
Quote:
Quote:
>>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"


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles