Re: How do you capture the value of a local variable from SQL Server?

Discussion in 'Microsoft Access VBA Modules' started by Tom van Stiphout, Mar 25, 2008.

  1. On Tue, 25 Mar 2008 12:43:08 GMT, "acraft" <u42371@uwe> wrote:

    You need to put that T-SQL code in a stored procedure, and return the
    string via an OUTPUT parameter.

    -Tom.


    >How do you capture this variable from SQL Server?
    >Example of T-SQL code:
    >
    >declare @strVariable varchar(20)
    >set @strVariable = 'This was a success...'
    >select @strVariable as NEW_FIELD
    >
    >How do I capture the returned value "This was a success..." without creating
    >a temporary table on the SQL Server? I am using MS Access and trying to use
    >the ADO.Recordset.
    >
    >
    >Should I use a different method? Any suggestions or sample code?
     
    Tom van Stiphout, Mar 25, 2008
    #1
    1. Advertisements

  2. On Tue, 25 Mar 2008 07:13:04 -0700, Tom van Stiphout
    <> wrote:

    Oops, Brendan is right. You can return it from a Select statement as
    well.
    -Tom.


    >On Tue, 25 Mar 2008 12:43:08 GMT, "acraft" <u42371@uwe> wrote:
    >
    >You need to put that T-SQL code in a stored procedure, and return the
    >string via an OUTPUT parameter.
    >
    >-Tom.
    >
    >
    >>How do you capture this variable from SQL Server?
    >>Example of T-SQL code:
    >>
    >>declare @strVariable varchar(20)
    >>set @strVariable = 'This was a success...'
    >>select @strVariable as NEW_FIELD
    >>
    >>How do I capture the returned value "This was a success..." without creating
    >>a temporary table on the SQL Server? I am using MS Access and trying to use
    >>the ADO.Recordset.
    >>
    >>
    >>Should I use a different method? Any suggestions or sample code?
     
    Tom van Stiphout, Mar 25, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    use the value of one variable as a new variable's name?

    Mark, Oct 8, 2003, in forum: Microsoft Access VBA Modules
    Replies:
    3
    Views:
    293
  2. Guest
    Replies:
    0
    Views:
    290
    Guest
    Sep 24, 2004
  3. Guest

    Assign a Variable a Value from SQL

    Guest, Jul 21, 2006, in forum: Microsoft Access VBA Modules
    Replies:
    4
    Views:
    1,368
    Guest
    Jul 24, 2006
  4. ryguy7272

    Access FE with SQL Server BE or .NET FE and SQL Server BE

    ryguy7272, Jun 14, 2009, in forum: Microsoft Access VBA Modules
    Replies:
    14
    Views:
    340
    vanderghast
    Jun 22, 2009
  5. rocco

    passing boolean variable value into SQL string

    rocco, Mar 25, 2010, in forum: Microsoft Access VBA Modules
    Replies:
    3
    Views:
    2,918
    rocco
    Mar 29, 2010
Loading...

Share This Page