' Revision Control
' 1.0   12/17/03   Initial Release

Dim cmd
Dim con
Dim constr
Dim BuyerID
Dim PoCount
Dim MsgStr
Dim RtnVal
Const adCmdStoredProc = 4

BuyerID = InputBox("Enter Buyer User ID")

Set con = CreateObject("ADODB.Connection")
constr = "driver=SQL Server;server=yourserver;uid=userid;pwd=password;database=yourdatabase;"
con.Open constr

set cmd = CreateObject("ADODB.Command")
set cmd.ActiveConnection = con
cmd.CommandText = "sp_sync_create_purchase_orders"
cmd.CommandType = adCmdStoredProc
cmd.Parameters(1) = BuyerID
cmd.Execute
RtnVal = cmd.Parameters(0)
PoCount = cmd.Parameters(2)

If RntVal <> 1 Then
   MsgBox("An error occured during processing. See process
   indicator in sync table.")
End If

MsgStr = CStr(PoCount) & "Purchase Orders Created"
MsgBox(MsgStr)

Set con = Nothing
Set cmd = Nothing