DateAdd does not work

L

lofty

Dear Lord,

I'm trying to code a drop down for a date entry that gives
the user the option of the current date plus the dates of
the last 7 days.

<%
for i = -7 to -1
Response.write "<option>" & DateAdd(d,i,Date())
& "<option>"
next
%>
Besides this, even the following code generates an error:

Today=Date()
Response.write DateAdd(d,5,Today)

your guidence is sought, oh great one.
amen
 
L

lofty

Thankyou,

but could u tell me why i'm getting the error

Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'DateAdd'

when i,m using dateAdd
 
M

Mosley

lofty said:
Dear Lord,

I'm trying to code a drop down for a date entry that gives
the user the option of the current date plus the dates of
the last 7 days.


aharrrrrrr


NO
DateAdd(d,i,Date())

Yes
DateAdd("d",i,Date())




<%
for i = -7 to -1
Response.write "<option>" & DateAdd(d,i,Date())
& "<option>"
next
%>
Besides this, even the following code generates an error:

Today=Date()
Response.write DateAdd(d,5,Today)

your guidence is sought, oh great one.
amen
 
B

Bob Barrows

lofty said:
Dear Lord,

I'm trying to code a drop down for a date entry that gives
the user the option of the current date plus the dates of
the last 7 days.

<%
for i = -7 to -1
Response.write "<option>" & DateAdd(d,i,Date())
& "<option>"
next
%>
Besides this, even the following code generates an error:

Today=Date()
Response.write DateAdd(d,5,Today)

your guidence is sought, oh great one.
amen

I'm not a lord; however:
in vbscript, the first argument needs to be quoted since it must be a
string:
DateAdd("d",i,Date())

If you do not have the vbscript reference, it can be downloaded from here:
http://tinyurl.com/7rk6

HTH,
Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top