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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to declare and set a variable in vbscript for DTS? 1

Status
Not open for further replies.

kskinne

Technical User
Oct 8, 2004
169
US
I am trying to use the following code to set the values of some global variables in a DTS package:

Code:
Function Main()
  Dim strFileName as String
  strFileName = InputBox("Enter file name without the file extension:")
  DTSGlobalVariables("gVarSourceFileName").Value = "C:\Documents and Settings\kskinner\Desktop\NBC\Qwest CDRs\" & strFileName & ".csv"
  DTSGlobalVariables("gVarImport_FileValue").Value = strFileName
  Main = DTSTaskExecResult_Success
End Function

It is giving me an error when I try to declare the variable strFileName, and set it's value using the inputbox. If I set the value of the two other global variables directly using inputbox, it works fine.

I'm guessing it's something really simple but I can't seem to figure it out - what's wrong with the syntax of my code?

Thank you,
Kevin
 
Instead of using..
Code:
Dim strFileName as String

just use
Code:
Dim strFileName
and you should be OK.

In VBScript, all variables are of type variant. Still catches me out!

Regards
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top