473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

Sep 3 '08 #1
4 1684
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.
Sep 3 '08 #2
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:uz**************@TK2MSFTNGP05.phx.gbl...
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

Sep 4 '08 #3
On Sep 4, 9:08*am, "Anthony Jones" <AnthonyWJo...@yadayadayada.com>
wrote:
"Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcomwrote in messagenews:uz**************@TK2MSFTNGP05.phx.gbl. ..


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.
Sep 4 '08 #4
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"
Sep 4 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: avital | last post by:
Hi, I have a sql query with cases. I need to add a condition that if hasamafactor=5 then display only cases m11-m14 else display the rest. Of course sum ( kamut) as total4mosad has to be only...
19
by: GMKS | last post by:
Hello all, I have 13 check boxes on a form. I am trying to check all the check boxes to determine if they are true or false when I close the form. At present only the first IF...Then...Else...
1
by: Dan H. | last post by:
Hello, I have an application that requires a collection that is sorted by a double field first, and then by a long field. So, lets say I have an class that has 2 fields called time, priority. I...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
4
by: ECathell | last post by:
I had read an article at one time that suggested a pattern to get around deeply nested if..then..else hell... Can anyone point me in that direction? select case statements wont work for me in...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
14
by: lawjake | last post by:
I am having a dispute at work over endifs, and cannot find any treatise on this. So I am hoping that I can get a lot of correspondece confirming my belief. Here it is: I believe the following:...
4
by: =?Utf-8?B?WmFyYm9yZw==?= | last post by:
I'm writing a little program that will run when a user logs in, checks their password expiration and also installs a piece of monitoring software if necessary. The program has to run on Vista so I...
15
by: jzakiya | last post by:
I'm translating a program in Python that has this IF Then chain IF x1 < limit: --- do a --- IF x2 < limit: --- do b --- IF x3 < limit: --- do c --- .----- ------ IF x10 < limt: ---...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.