Results 1 to 6 of 6

Thread: Whats wrong with this code

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Whats wrong with this code

    hello
    i m using the following code to show report

    VB Code:
    1. Public Sub ChkExpense()
    2.  
    3.     MdateQry = " BETWEEN #" & VBA.Format(Me.TxtFrom, "MM/DD/YYYY") & "# And #" & VBA.Format(Me.TxtTo, "MM/DD/YYYY") & "#"
    4.    
    5.     Set Rs = New ADODB.Recordset
    6.     With Rs
    7.         .Open "Select * from Tbl_Adjustment where Adj_Date" & MdateQry, Db, adOpenDynamic, adLockOptimistic
    8.  
    9.         Report.Database.SetDataSource Rs
    10.         CRViewer1.ReportSource = Report
    11.    
    12.  '   Report.RecordSelectionFormula = "{Tbl_Payment_Receipt.Rec_No} = " & FrmRecovery.TxtNo & ""
    13.    
    14.         Report.FormulaFields.Item(1).Text = Chr(34) & TxtFrom.Text & Chr(34)
    15.         Report.FormulaFields.Item(2).Text = Chr(34) & TxtTo.Text & Chr(34)
    16.  
    17.         StrSelectionFormula = "{Tbl_Adjustment.Adj_Date} in Date(" & _
    18.         Format(Me.TxtFrom, "yyyy,m,d") & ") to Date(" & _
    19.         Format(Me.TxtTo, "yyyy,m,d") & ")"
    20.                
    21.         Report.RecordSelectionFormula = StrSelectionFormula
    22.         CRViewer1.ViewReport
    23.    
    24.         CRViewer1.Zoom 95
    25.         Report.DiscardSavedData
    26.     End With
    27. 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
    Last edited by hafizfarooq; Oct 7th, 2006 at 08:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width