Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    57

    Unanswered: Using Stored Procedures With a List Box

    Hi,

    I have a list box on an access form and I want the row source to be a stored procedure. If I use an SP with no parameters it works great. But I want to pass a parameter and have the source come from another text box or combo box on the same form. SO for the Row Source I have Exec MYSPName and that works good. Now I want to change it to Exec MYSPName @MyParam = Myform.cbo_Box.Value.

    This doesn't work. Does anyone know how to get this to work?

    Thanks!

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    This is an ADP?

    You don't show us how you do this.

    If you can use the relevant event(s), you could use something like this

    Me!lstMyList.RowSource = "Exec MYSPName " & Myform.cbo_Box.Value

    if numeric. If text

    Me!lstMyList.RowSource = "Exec MYSPName '" & Myform.cbo_Box.Value & "'"

    Just pass the parameters in the order they occur in the SP
    Roy-Vidar

  3. #3
    Join Date
    Oct 2003
    Posts
    57
    I am setting this as the RowSource property directly using the properties of the list box on the form. Can you not use the parameters for a SP this way? If I am not being clear please let me know what info you need.

    Thanks

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I'm not very experienced with ADPs but I think the problem is that the text string is passed to the server and parsed there. The server knows nothing about forms and controls - it just wants an absolute value not a reference to where it can find it.

    So - Roy's idea is for vb to grab the value from the form and pass that (as a value) to the procedure. That sounds like the right idea to me.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Oct 2003
    Posts
    57
    Thanks for the info, will give this a try!

Posting Permissions

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