Results 1 to 6 of 6

Thread: Whats wrong with this code

  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.

  2. #2

  3. #3

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

    Re: Whats wrong with this code

    Sorry, RhinoBull. Ishall be crefull next time.
    Waht about my question ? Have u any solution ?

  4. #4
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    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
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  5. #5
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    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?

  6. #6

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