Stored Proc in MS ACCESS Database Project With MS SQL Server 2008R2

  • This may be an easy answer to this question but I'm not staying focused enough to have any luck,

    If I have a stored procedure:

    ALTER PROCEDURE dbo.StoredProcedure1

    @EI_ID varchar(6)

    AS

    SELECT EI_ID, EVENT_DATE, EVENT_NO, SYS_CODE, DISC_TIME, EI_BEG_AGE, NARR, CORR_DATE_TIME, EI_CORR_AGE, CORR_NARR

    FROM dbo.tbl_List_Maint_Event

    WHERE EI_ID = @EI_ID

    Order by EVENT_DATE

    : How do I make the WHERE parameter come from a combobox named cboSA on form AcftSelect? "WHERE EI_ID = [Forms]![AcftSelect]![cboSA]& "" " is having an issue with the "!" and not being bound?

    It is Monday.....

  • In Access VBA, he is the basic way to call a proc:

    Dim rs As New ADODB.Recordset

    rs.Open "dbo.StoredProcedure1 " & [Forms]![AcftSelect]![cboSA], CodeProject.Connection, adOpenForwardOnly

    'do stuff

    rs.Close

    Just concatenate the proc name and the parameters.

    Edit: whoops, quotes

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • I do something like this in Access07 .adp:

    Dim Requestorid As String

    Requestorid = Combo139.Column(1) 'for combobox... use .value for textbox

    strsend = "exec PROCNAME @requestorid='" + Requestorid + "'"

    CurrentProject.Connection.Execute strsend

  • Thanks toddasd and NJ-DBA for the suggestions....I will post my results

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply