Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with variable

Status
Not open for further replies.
Oct 9, 2003
174
US
I have an input box where a user enters a number. I then want that variable to be put into the dtmOld variable but I keep messing up the syntax. Can someone help? I've tried mutiple combinations. This is one of them.


daysold = InputBox ("What is the number of days you want the script to look back?")
dtmOld = "DateAdd("d", -"& daysold &" Now)"
Wscript.echo dtmold

I don't think the quotes are correct because everytime I put them there I get an expected end of statement.

Thanks in advance for you help.
 
I was over thinking it. I could just call the variable without the "'s and &'s. Rookie mistake!!

Thanks anyway
 
A simpler way:
dtmOld = Now - daysold

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Alternately...

dtmOld = DateAdd("d", -1 * daysOld, Now())

Don't forget your algebra... [wink]

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top