473,241 Members | 1,761 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,241 software developers and data experts.

Microsoft VBScript runtime (0x800A01F5): Illegal assignment: variable name

<% hour = Request("controlname") %> will yield the following error:

Microsoft VBScript runtime (0x800A01F5)
Illegal assignment: 'hour'

However, if I declare hour, then it is fine.
<%
Dim hour
hour = Request("controlname")
%>

But I think in VBScript, declaration of a variable is optional? That means
we can use the variable without writing "Dim hour" ??

Please advise! thanks!

Jul 19 '05 #1
3 15107
If u use a variable name that is NOT a function name as well, then u don't
have to declare it.
Hour( ) is a built-in function.

"Matt" <ma*******@hotmail.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
<% hour = Request("controlname") %> will yield the following error:

Microsoft VBScript runtime (0x800A01F5)
Illegal assignment: 'hour'

However, if I declare hour, then it is fine.
<%
Dim hour
hour = Request("controlname")
%>

But I think in VBScript, declaration of a variable is optional? That means
we can use the variable without writing "Dim hour" ??

Please advise! thanks!

Jul 19 '05 #2
Matt wrote:
<% hour = Request("controlname") %> will yield the following error:
Hour() is a builtin vbscript function. Do NOT use ambiguous words for
variable names.

Microsoft VBScript runtime (0x800A01F5)
Illegal assignment: 'hour'

This is why "hour" should not be used for the variable name.
However, if I declare hour, then it is fine.
No, it is not.
<%
Dim hour
hour = Request("controlname")
%>
Try calling the Hour() function after declaring it as a variable.

dim hour
hour=3
Response.Write(hour(#13:25:00#))

You will quickly see why it is not fine. :-)

Now I realize that it can add much time to your coding if you have to look
up all the variable names you wish to use in online documentation to make
sure you aren't using a keyword. The solution is to use a naming convention
that will guarantee that your variable names never conflict with builtin
names. The convention can be as simple as always prefixing your variables
with the letter "v", vHours instead of hours. Or it can be a little more
informative (as well as making your code more self-documenting) by using
"str" for string variables, "int" for integers, etc.

But I think in VBScript, declaration of a variable is optional?


That does not make it right to do so. Always use "Option Explicit" at the
beginning of your code blocks. This will force you to declare your variables
and prevent embarassing and time-consuming mistakes.

HTH,
Bob Barrows
--
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"
Jul 19 '05 #3
Yeah, just use theHour or somthing to that effect ... or when I am
lazy, I will pout the letter z in front of everything .. LOL

zHour
On Sat, 10 Jan 2004 23:23:05 -0800, "Matt" <ma*******@hotmail.com>
wrote:
<% hour = Request("controlname") %> will yield the following error:

Microsoft VBScript runtime (0x800A01F5)
Illegal assignment: 'hour'

However, if I declare hour, then it is fine.
<%
Dim hour
hour = Request("controlname")
%>

But I think in VBScript, declaration of a variable is optional? That means
we can use the variable without writing "Dim hour" ??

Please advise! thanks!


Jul 19 '05 #4

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

Similar topics

3
by: Matt | last post by:
The ASP page has a combo box with id list, and when user click the particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call...
1
by: JNariss | last post by:
Hello, I have created a connection to my Access database with Dreamweaver and made a simple form with 4 fields. The code behind this form was/is: <%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
3
by: Snow | last post by:
Hello: I have Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: '' The error happened at this line: if session("systemIdCount" & arrSystems(iLoop)) 0 The code like this:
2
by: anidmarty | last post by:
Hey I'm a Sysadmin and my users are getting this error on my production box. It works fine on the dev box. There is a script that is run that generates this error. Production is clustered...
4
by: rohitdoke | last post by:
Hello, we are using IIS 6.0 and facing an error as Microsoft VBScript runtime error '800a01c2' Wrong number of arguments or invalid property assignment: 'verifychecksum' ...
1
by: monika | last post by:
Hello: I have Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: '' /OnlineLIB/BNosearch1.asp, line 32 The error happened at this line:bookno = chr(bookno) The code like...
1
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
10
by: jasone | last post by:
hi everyone! any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime ...
1
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. ...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.