Report opens twice when using a stored procedure

Posted by: storms-dd on 4 August 2017, 3:13 pm EST

  • Posted 4 August 2017, 3:13 pm EST

    <P>Please help!</P>
    <P> </P>
    <P>I changed a report from using a SQL statement with an ADO control, to executing a stored procedure.  Now the report opens twice when I click the command button to open the report.  Thank you!  Here is my code:</P>
    <P> </P>
    <P>Option Explicit<BR>Option Base 0</P>
    <P>Private sdate<BR>Public rptType As Integer</P>
    <P>Public Property Get TheDate() As String<BR>    TheDate = sdate<BR>End Property</P>
    <P>Public Property Let TheDate(ByVal sNew As String)<BR>    sdate = sNew<BR>End Property</P>
    <P><BR>Private Sub ActiveReport_ReportStart()<BR>    Dim sSQL As String</P>
    <P>    Field1.Text = Me.TheDate</P>
    <P>    Me.MousePointer = vbHourglass<BR>    Me.Printer.Orientation = vbPRORLandscape</P>
    <P>    arManInsp.TheDate = Me.TheDate</P>
    <P>    Dim ADOrs As adodb.Recordset<BR>    Set ADOrs = New adodb.Recordset<BR>    Dim oConnection As adodb.Connection<BR>    Set oConnection = New adodb.Connection<BR>    Dim oCommand As adodb.Command<BR>    Set oCommand = New adodb.Command</P>
    <P>    With oCommand<BR>        .ActiveConnection = mdiMain.cn<BR>        .CommandType = adCmdStoredProc<BR>        .CommandText = "GetDailyInspectionList"<BR>        .Parameters.Append .CreateParameter("@RETURN_VALUE", adInteger, adParamReturnValue)<BR>        .Parameters.Append .CreateParameter("@RptDate", adDate, adParamInput, , Me.TheDate)<BR>    End With</P>
    <P>    arManInsp.Printer.Orientation = ddOLandscape</P>
    <P>    Set ADOrs = oCommand.Execute<BR>    Set dcmain.Recordset = ADOrs</P>
    <P>    Me.MousePointer = vbNormal</P>
    <P>End Sub</P>
  • Replied 4 August 2017, 3:13 pm EST

    Hello,
    <br />
    <br />Can you please explain a little bit more about this line of code:
    <br />Set dcmain.Recordset = ADOrs
    <br />
    <br />You may also view following Knowledge Base article which provides more information on how to use Stored Procedures with Active Reports:
    <br />http://www.datadynamics.com/forums/340/ShowPost.aspx
    <br />
    <br />Do let me know if you require further assistance/clarifications.
    <br />
    <br />Best Regards,
    <br />Amit
    <br />
  • Replied 4 August 2017, 3:13 pm EST

    <P>Thank you for your reply, Amit.</P>
    <P>I don't know if I still need this control or not, but "dcmain" is the name of my ADO control.</P>
    <P>Let me know if I can answer any other questions.</P>
    <P>Jeff</P>
  • Replied 4 August 2017, 3:13 pm EST

    Hi Jeff,
    <br />
    <br />Have you tried the sample application from Knowledge Base article?
    <br />If the KB sample works, then please provide us a small sample application in which report is opening twice when using the Stored Procedures.
    <br />
    <br />Any further information to isolate the issue would be highly appreciated.
    <br />
    <br />Best Regards,
    <br />Amit
    <br />
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels