Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    16

    Question Unanswered: How to pass a parameter from a form to a stored procedure?

    Hi All,

    I am using an ADP, and I have an unbound control in a form, where a user can input a name, and I would like to be able to pass this name as a parameter to a stored procedure.

    To make it as simple as possible, let's say we have the following:
    1. A form called Frm1
    2. An unbound text box, called TB1, in form Frm1
    3. A stored procedure called SP1
    4. A field in the stored procedure, called Field1, to which I am trying to pass the value of TB1, from Frm1.

    I have a command button in Frm1 that opens SP1. But how do I tell it to open SP1 in such a way that Field1=TB1?

    One thing I tried was to use the following code in the stored procedure:

    SELECT Field1
    FROM dbo.TblTable1
    WHERE Field1=Forms![Frm1]![TB1]

    Needless to say, this did not work. Nor did various modifications of this code. What am I doing wrong?

    Any ideas would be greatly appreciated. I have been reading various sites, and a lot of people seem to be having this problem, but I can't find any solutions that have worked.

    Thanks.

    Henry

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    change your stored procedure to a function and let it accept a parameter. call your function like so:
    call sb1(tb1)

  3. #3
    Join Date
    Jan 2004
    Posts
    16
    Originally posted by jmrSudbury
    change your stored procedure to a function and let it accept a parameter. call your function like so:
    call sb1(tb1)
    Ahh, that's the ticket!

    Thanks very much!

    Henry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •