3 Replies - 5862 Views - Last Post: 24 January 2011 - 05:12 PM Rate Topic: -----

#1 ayawdong   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 08-December 10

Print report by date range

Posted 08 December 2010 - 09:06 PM

Hi

I'm using visual basic 6.0 and ms access 2003 as my database. I want to print reports between the range of the 2 datepickers. There's no error in my code but the report is wrong, the report shows all the data instead of the data between the range of the 2 dtpickers. Please see my code below. Please help.

If Combo1.Text = "By Date" Then
  With rs
    If .State = adStateOpen Then .Close
     .Open "select * from Serviced where Schedule >= #" & date2.Value & 
      "# and Schedule <= #" & date3.Value & "#", cn,2, 3     

        If .EOF = True Then
                MsgBox "No Record to Print!", vbOKOnly + vbExclamation,
               "No Record"
             Else                               
                RptMonthly.Show
        End If                                           
   End With                
End If


Is there a problem with my query? Your help is very much appreciated. Thanks!


Kim

This post has been edited by modi123_1: 08 December 2010 - 11:12 PM
Reason for edit:: please use code tags..


Is This A Good Question/Topic? 0
  • +

Replies To: Print report by date range

#2 raziel_   User is offline

  • Like a lollipop
  • member icon

Reputation: 469
  • View blog
  • Posts: 4,281
  • Joined: 25-March 09

Re: Print report by date range

Posted 09 December 2010 - 01:59 AM

check if the format of your date in the access database and the datapicker is the same.
also (i maybe wrong never use reports) i cant see where you set the recordset to be your reports data.
Was This Post Helpful? 0
  • +
  • -

#3 ayawdong   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 08-December 10

Re: Print report by date range

Posted 09 December 2010 - 02:43 AM

thanks for your reply...

Yes the formats are same. sorry to ask but were will i set recordset for my reports data? im still new in reports.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Sylvester*


Reputation:

Re: Print report by date range

Posted 24 January 2011 - 05:12 PM

I have a problem too.. I cant find the Orientation Property..

Can anyone help me?
Was This Post Helpful? 0

Page 1 of 1