PDA

Click to See Complete Forum and Search --> : data report output still the same


KGComputers
Dec 8th, 2005, 09:15 PM
Hi to all!

I have a problem with my data report.

when I pass these values to the parameters for the first time, it will produce the output correctly. On the second processing, the output will never change. The output is still the same.
An example is when I input values for dates of sales that occured in range with November 11 - November 16, it will produce the correct output. However, in the second processing like I input values like dates December 1 and December 25, the output does not change. It will display the sales from November 11 - November 16.

Here is the code...

Private Sub cmdProcessReport_Click()
deOrders.Commands(6).Parameters(0).Value = s_date
deOrders.Commands(6).Parameters(1).Value = e_date
End Sub

Private Sub cmdViewReport_Click()
rptSalesReport.WindowState = vbMaximized
rptSalesReport.Show
End Sub

Is this has something to do with the parameters passed to the data environment command qrySalesReport?

Hoping for any response.... :) :) :)

rush_shri
Dec 8th, 2005, 09:40 PM
why don't you try "rptsalesreport.refresh" before passing parameters.

KGComputers
Dec 8th, 2005, 10:20 PM
Hi rush_shri!

I tried it already. Inserting the refresh before the parameters will display the report first, then an error message will appear. The message is Parameter1 has no default value..

:) :) :)

dee-u
Dec 8th, 2005, 10:41 PM
Are you using a client-side cursor?

KGComputers
Dec 8th, 2005, 11:05 PM
Greetings!!!!

Yes, Im using (use client-side cursor) for my cursor location....

:) :) :)

dee-u
Dec 8th, 2005, 11:07 PM
Have you tried...

rptSalesReport.Refresh

KGComputers
Dec 8th, 2005, 11:11 PM
Greetings!!!

Yes, I've done that already....

I placed the refresh before the passing of values code. It will generate an error message.I tried to insert the refresh after the code, the output doesnt change...

:) :) :)

dee-u
Dec 8th, 2005, 11:31 PM
Would you post all your code involve in that report-generation?

KGComputers
Dec 8th, 2005, 11:47 PM
Hi.....

Here is the code for my report generation form (frmSalesReport)..

The codes with comment are the previous solutions I've used...

This code that I've posted a while ago was working though with errors on the result of data report...




Option Explicit
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim prm1 As New ADODB.Parameter
Dim prm2 As New ADODB.Parameter
Dim rst As New ADODB.Recordset
Dim strsql As String

Private Sub cmdExit_Click()
Set rst = Nothing
Set cnn = Nothing
Unload Me
End Sub

Private Sub cmdProcessReport_Click()
Dim s_date As String
Dim e_date As String

'dtPicker controls dtStart and dtEnd
s_date = dtStart.Value
e_date = dtEnd.Value

deOrders.Commands(6).Parameters(0).Value = s_date
deOrders.Commands(6).Parameters(1).Value = e_date

Print s_date & " " & e_date

'With cmd
' .ActiveConnection = cnn 'predefined connection object
' .CommandType = adCmdText
' .CommandText = "select * from qrySalesReport"
' .Parameters(0) = DateValue(s_date)
' .Parameters(1) = DateValue(e_date)
' Set rst = cmd.Execute
'End With

'With rptSalesReport
' Set .DataSource = rst
' .DataMember = rst.DataMember
'End With
'With cmd
' Set .ActiveConnection = cnn
'.CreateParameter "[Starting Date]", adDate, adParamReturnValue, , DateValue(s_date)
'.CreateParameter "[Last Date]", adDate, adParamReturnValue, , DateValue(e_date)

'.Parameters.Append cmd.CreateParameter("[Starting Date]", adDate, adParamInput, , CDate(s_date))
'.Parameters.Append cmd.CreateParameter("[Last Date]", adDate, adParamInput, , CDate(e_date))
'.CommandType = adCmdStoredProc
'.CommandText = "qrySalesReport"

' .CommandText = "Select * from qrySalesReport where OrderDate Between" & #s_date# & "And" #e_date#
'Set rst = cmd.Execute
'End With
cmdViewReport.Enabled = True
txtStart.Text = s_date
txtEnd.Text = e_date
End Sub

Private Sub cmdReset_Click()

If dtStart.CheckBox = False Then
dtStart.Value = Null
End If
If dtEnd.CheckBox = False Then
dtEnd.Value = Null
End If


End Sub

Private Sub cmdViewReport_Click()
rptSalesReport.WindowState = vbMaximized
rptSalesReport.Refresh
rptSalesReport.Show
End Sub

Private Sub Form_Load()
cmdViewReport.Enabled = False
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=d:\POSSample\Orders.mdb;"
dtStart.CheckBox = True
dtEnd.CheckBox = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set rst = Nothing
Set cnn = Nothing
End Sub



Is the problem has something to do with the value property of the command in my data environment? How do I make sure if the parameters being passed will take effect and will replace the old values?

:) :) :)

techgnome
Dec 8th, 2005, 11:57 PM
Crystal, right? Open the report, and under the File menu... make sure the "Save Data With Report" option is TURNED OFF. For what ever reason, this is turned on by default. We ran into this problem we ran into early on with CR until some one figured it out.

-tg

KGComputers
Dec 9th, 2005, 12:03 AM
Hi!!!

Im still using the built in data report designer....