October 11, 2006 at 8:28 am
Ok, I am frustrated. I specify my active X object to use VB Script as the language for my code. Half of the VB code that I write won't work in the object. I mean SIMPLE things like the Now() and Date() functions aren't supported. I have done searches on VB script and these functions are suppose to be there. Anyway, here's the code that I am trying to get to work in my DTS job:
Dim TodayDate
Set TodayDate = Now()
I am trying to put the current date and time into a variable. It parses fine, but I get an Error on the second line expecting an object after the equals sign. What the !#$@#$@ is going on? I gotta be missing something simple here.
Thanks in advance for any responses to this post.
October 11, 2006 at 10:36 am
Those common functions are supported, the problem is your use of Set. You don't use set in cases like this.
Dim TodayDate
TodayDate = Now()
October 12, 2006 at 3:34 am
As Erik said, only use 'set' for reference types such as objects. It's one of those "charming" quirks of VB.
October 12, 2006 at 5:33 am
I had already found that out, I just hadn't had time to post the fix. Why is there so many examples of using the Set command to assign variables on the web? Can it be done in VB, but not VB script? Very frustrating.
October 12, 2006 at 6:16 am
Same in VB and VBScript.
Set is used for assigning objects. And actually, it is LET that is used for assigning native datatypes (like date, integer, string, etc). But Let is optional, so you rarely ever see it in code.
Hope this helps
Mark
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply