I built the following code to run a report:
Private Sub cmdTest_Click()
If Not IsNull(txtDateFrom) Or (txtDateFrom <> "") Then
When I run it displays the report strait away but if I try to run another report it gives a Run-time error '3705' saying: Operation not allowed when the objects is open.
If after or before the line saying dataReport2.Show I insert the following line: DataEnvironment1.rsCommand2.Close I get another error saying: Prepared statment '(@P1 nvarchar(50))SELECT tblP.switchname, tblN.NNI, tblB' expects parameter @P1, which was not suplied.
Is there anyone that could tell me what I'm doing wrong or tell me the steps to run a report?
>Is there anyone that could tell me what I'm doing wrong.
Using DataEnvironment (which is an atractive thing at a first glance but in reality just introduces problems and limits the flexibility of you application)
Please open your connection and recordset (rs) 'in code'
To bind your recordset to the Datareport use its .DataSource property.