Results 1 to 2 of 2
  1. #1
    system243trd is offline Novice
    Windows 2K Access 2003
    Join Date
    Nov 2011
    Posts
    27

    Populating a combo box using a stored procedure with parameters

    I have created an Access 2010 project that is connected to a SQL Server database. I have created a stored procedure sp_retrieveinfo


    that contains two input parameters which are text boxes on a forn (text1 and text2).


    Following the update of the cmbabc field I have attempted to populate another combo box called cmbdef using the rowsource function.


    Below is the code


    Private Sub cmbabc_AfterUpdate()


    Me!cmbdef.Rowsource = "sp_retrieveinfo '" & Me.text1 &" ', " & Me.text2 & "'"


    I receive the following error message when I select the cmbdef field.


    'The record source 'sp_retrieveinfo ... specified on this form or report does not exist'.


    If I amend the SQL stored procedure to use no input parameters and amend the code in Access, this works fine. Can anyone help?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You can set the source of the combo to the name of a stored procedure? Or a pass-through query? I can't see the first, unless this is an ADP, in which case I'm not sure. They never really caught on. If not an ADP, I'd suspect you'd have to manipulate the SQL of the pass through query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with SQL stored procedure
    By emmahope206 in forum Access
    Replies: 1
    Last Post: 05-24-2016, 05:03 PM
  2. Replies: 33
    Last Post: 09-25-2015, 08:39 AM
  3. Replies: 13
    Last Post: 01-30-2013, 03:05 PM
  4. Replies: 2
    Last Post: 08-29-2012, 08:01 AM
  5. Replies: 3
    Last Post: 03-20-2012, 10:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums