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

VBSCRIPT to call SQL Stored Procedure in Outlook form

Status
Not open for further replies.

csudougie

MIS
Dec 15, 2006
37
0
0
Hello,

I'm having trouble getting my vbscript to execute a SQL stored procedure over an ODBC connection from an Outlook form.

The s.p. only accepts one integer and returns a string value. Can anyone help me with the syntax or point me in a direction. I've looked into pass-through queries, but they want to run in VB and the funtions I've found don't like vbscript.

Thanks.
 
You'd probably be better off being more specific (perhaps including at least a snippet of your code and/or example data), and also asking that in a different forum.

I'd suggest this one first:
forum329
Or perhaps this one, if you think the error is moreso SQL based:
forum183

--

"If to err is human, then I must be some kind of human!" -Me
 
Option Explicit
dim rc, sql, cnn

sub OpenConn()
dim dsn
set cnn = CreateObject("ADODB.Connection")
dsn = "Provider=sqloledb;Data Source=MAJ_LINKED_TABLES;"
cnn.Open dsn
SQL = "{EXECUTE dbo.GET_CUS_NAME_fn(myvalue)}"
end sub

Sub cmdTest_Click()

dim objPage, objControl
dim s
dim MyValue
Set objPage = Item.GetInspector.ModifiedFormPages("Message")
Set objControl = objPage.Controls("txt_So")
MyValue = objControl.Value
OpenConn()
rc = cnn.Execute (SQL)
msgbox rc
end sub
 
Are you sure you didn't mean this is a VBA method? I know they have some similarities.

If it's VBA, you'd best be posting here:
forum707

--

"If to err is human, then I must be some kind of human!" -Me
 
And if it is a SQL error for sure, and you are running a custom SQL store procedure, you definitely want to go to THAT code, I would think, and post over in the SQL forum. You need to get your question to the best possible viewers for answering the specific issue.

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top