With adoCommand
.Parameters.Append .CreateParameter("RETURN_VALUE", _
adInteger, adParamReturnValue, 0)
.Parameters.Append .CreateParameter("@Zip", _
adVarChar, adParamInput, 20, Null)
.Parameters.Append .CreateParameter("@State", _
adVarChar, adParamInputOutput, 2, Null)
.Parameters.Append .CreateParameter("@City", _
adVarChar, adParamInputOutput, 50, Null)
.Parameters("@Zip") = Zip
SQL = "usp_GetCityStateForZip"
.CommandText = SQL
.CommandType = adCmdStoredProc
.ActiveConnection = "Pubs"
.Execute
'Check the return value after the update
If .Parameters("RETURN_VALUE") = 0 Then _
State = .Parameters("@State") & "
City = .Parameters("@City") & "
End If
End With
|