Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Report using store procedure as datasource


Message #1 by "Mark.Chen" <Mark.Chen@s...> on Fri, 26 Oct 2001 14:46:03 -0500
Hi there,



In my Access project, I am trying to make a report using a store procedure

as the datasource. I wrote a event handler for report open(see attached).

The parameters are passed from a form that is open at the moment.



The code executed fine, but aftet the event handler finishes, Access

prompted the user to input for parameter. How can I stop it from asking?



Thanks,



Mark



***************************************************



rivate Sub Report_Open(Cancel As Integer)

  Dim cnn As ADODB.Connection

  Dim cmGetTravelerData As ADODB.Command

  

  Set cnn = New ADODB.Connection

  Set cmGetTravelerData = New ADODB.Command

  

  cnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User

ID=sa;Initial Catalog=iPAQ;Data Source=SQL; Password=;"

  

  With cmGetTravelerData

    .ActiveConnection = cnn

    .CommandType = adCmdStoredProc

    .CommandText = "spGetTravelerData"

    .Parameters.Append .CreateParameter("@date", adVarChar, adParamInput,

20, _

                                        Form_frmJobSubform.date)

    .Parameters.Append .CreateParameter("@serialNum", adVarChar,

adParamInput, 20, _

                                        Form_frmJobSubform.serialNum)

    .Execute

    .ActiveConnection = Nothing

  End With

  'Report_rptTraveler.InputParameters date = [@date]

End Sub

  Return to Index