Whats wrong with this code
hello
i m using the following code to show report
VB Code:
Public Sub ChkExpense()
MdateQry = " BETWEEN #" & VBA.Format(Me.TxtFrom, "MM/DD/YYYY") & "# And #" & VBA.Format(Me.TxtTo, "MM/DD/YYYY") & "#"
Set Rs = New ADODB.Recordset
With Rs
.Open "Select * from Tbl_Adjustment where Adj_Date" & MdateQry, Db, adOpenDynamic, adLockOptimistic
Report.Database.SetDataSource Rs
CRViewer1.ReportSource = Report
' Report.RecordSelectionFormula = "{Tbl_Payment_Receipt.Rec_No} = " & FrmRecovery.TxtNo & ""
Report.FormulaFields.Item(1).Text = Chr(34) & TxtFrom.Text & Chr(34)
Report.FormulaFields.Item(2).Text = Chr(34) & TxtTo.Text & Chr(34)
StrSelectionFormula = "{Tbl_Adjustment.Adj_Date} in Date(" & _
Format(Me.TxtFrom, "yyyy,m,d") & ") to Date(" & _
Format(Me.TxtTo, "yyyy,m,d") & ")"
Report.RecordSelectionFormula = StrSelectionFormula
CRViewer1.ViewReport
CRViewer1.Zoom 95
Report.DiscardSavedData
End With
End Sub
The problem is that when i entered the date for the same month, it shows the reuslt lik 01/10/2006 to 30/10/2006
But when i entered the date between 2 months it shows nothing like
01/10/2006 to 10/11/2006
Whats wrong with this code. please help me.
Farooq
Re: Whats wrong with this code
You seemed to be a member for about 2.5 years so it's about time you learn how to use VBCODE tags when posting code. Thanks.
Re: Whats wrong with this code
Sorry, RhinoBull. Ishall be crefull next time.
Waht about my question ? Have u any solution ?
Re: Whats wrong with this code
Maybe if you edit your post and put
[vbcode ]
[/Highlight]
around your code, we would be able to read it easier and then could help :)
Re: Whats wrong with this code
Which had the wrong info, or rather where did the wrong info start appearing?
MdateQry? Recordset? Report object? CRViewer1 output?
Re: Whats wrong with this code