Solved

ActivexX InputBox

Posted on 2004-09-08
11
455 Views
Last Modified: 2008-03-17
Hi,

In ActiveX, is there a way to take imput from user and then do some validation.  User can click on eithere OK or CANCEL to proceed or quit DTS?  Thx
0
Comment
Question by:mcrmg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 12

Expert Comment

by:patrikt
ID: 12006229
Who do you suppose is user? DTS package is running on server in server service context. It has no user interface and no user to ask.

Patrik
0
 

Author Comment

by:mcrmg
ID: 12006421
lol............

You are right........ I meant the person who use this DTS.... (in this case, it would be me........)

Sorry for the confusion...
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 12006627
Add an ActiveX script and use something like this:

Function Main()
Dim Value
Dim IsValid

Value = InputBox("Enter value here", "")
'  Do validation here and set the IsValid variable appropriately

If IsValid Then
      Main = DTSTaskExecResult_Success
Else
      Main = DTSTaskExecResult_Failure
End If

End Function

Then set your Workflow to only proceed if the previous task is successful.

And finally, don't even attempt to schedule this DTS package :)
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:mcrmg
ID: 12010831
This is what I try to do, something like this:

When I enter a value, say, 9

it will take that 9 and show in msgbox, say, September

If I click on OK, DTS will proceed, if I clcik on CANCEL, DTS will quit. possible?  Thx

0
 
LVL 12

Accepted Solution

by:
patrikt earned 170 total points
ID: 12011346
Code sample:

First ActiveX script.It takes value and validates it. If valid it goes to next step.

Function Main()
      Value=InputBox("Give me value", 0  )
      If Value>12 or Value<1 Then
            Main=DTSTaskExecResult_Failure
      else
            DTSGlobalVariables("Month").Value=Value
            Main = DTSTaskExecResult_Success
      end if
            
End Function

Secon ActiveX script. It displays value and by user response it results as Success or failure.

Function Main()
      OK=MsgBox( "This is correct value:" + DTSGlobalVariables("Month").Value,  vbYesNo)
      If OK=vbYes Then
            Main = DTSTaskExecResult_Success
      ELSE
            Main =DTSTaskExecResult_Failure
      end if
End Function

For value storrage it uses Global variable "Month". You define global variables in package properties.

Patrik
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 150 total points
ID: 12011400
>>If I click on OK, DTS will proceed, if I clcik on CANCEL, DTS will quit. possible? <<
Yes.  Something like this:

Function Main()
Dim Value
Dim IsValid

IsValid = False

Value = Trim(InputBox("Enter value here", ""))
If IsNumeric(Value) Then
   If Len(Value) <= 2 Then
      If Value >= 1 And Value <= 12 Then
         If MsgBox("Did you really want " & MonthName(Value) & "?", vbYesNo) = vbYes Then
            IsValid = True
         End If
      End If
   End If
End If

If IsValid Then
     Main = DTSTaskExecResult_Success
Else
     Main = DTSTaskExecResult_Failure
End If

End Function
0
 

Author Comment

by:mcrmg
ID: 12015214
Hi,

I was trying the code, then for some reason that I can not find the panel that I can put in the code.  When double click on Activex in dts, it pops up ActiveX Script Task Properties, How can I open the panel that I can write the code?  Thx
0
 

Author Comment

by:mcrmg
ID: 12015240
usually, there is "language" on left hand side, and a panel for coding on right hand side, the one on right hand side disappeared.......
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 12016666
>>When double click on Activex in dts, it pops up ActiveX Script Task Properties, How can I open the panel that I can write the code?<<
No idea what could be happening.  I just created a new package and single clicked on the ActiveX Script Task icon on the left and the new window opened to enter the code.
0
 

Author Comment

by:mcrmg
ID: 12016763
very strange, if I work on the server directly, it is fine.  But if I open it on client, I do not have edit area.......
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 150 total points
ID: 12016815
Not sure.  Perhaps it is time to re-install the client components.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question