make a datareport with condition

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

make a datareport with condition

 
0
  #1
Nov 3rd, 2008
I made a datareport simple. just connect. but I want to make it with condition. I have 2
dtpicker for date. I want 1 day report or weekly or monthly report by dtpicker. example
I want 03/11/08 report or 01/11/08 to 03/11/08 report. But I dont know how make it. Where I write code or how I collect it. Help me. I want I select a date from dtpicker or form both dtpicker and click a button then the report show.
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: make a datareport with condition

 
0
  #2
Nov 3rd, 2008
you need to frame the sql dynamically at runtime and pass the same to the report.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 45
Reputation: AUGXIS is an unknown quantity at this point 
Solved Threads: 11
AUGXIS's Avatar
AUGXIS AUGXIS is offline Offline
Light Poster

Re: make a datareport with condition

 
0
  #3
Nov 3rd, 2008
hi. you can write the query first. then i think you have to set the record source of your report
to the query you made.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

Re: make a datareport with condition

 
0
  #4
Nov 3rd, 2008
>> you need to frame the sql dynamically at runtime and pass the same to the report.

how can I pass to the report?

>>hi. you can write the query first. then i think you have to set the record source of your report
to the query you made.

How can I connect between the button and the report. I meant when I select date and press button then how the report show by code.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 45
Reputation: AUGXIS is an unknown quantity at this point 
Solved Threads: 11
AUGXIS's Avatar
AUGXIS AUGXIS is offline Offline
Light Poster

Re: make a datareport with condition

 
0
  #5
Nov 4th, 2008
hi. you try to make a query first.say
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. rs.Open "Select appdate, name from tablename where appdate between '" & date1 & "' AND '" & date2 & "'"
then set the record source of the report
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set repo.DataSource = rs
  2. repo.Title = "Hello"
  3. repo.Show
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

Re: make a datareport with condition

 
0
  #6
Nov 6th, 2008
when I made report I use adodc control by DSN. table select by code like
"select * from table1". I use adodc control in full project and connect with property
not by code.
so help me with details code. I didn't understand your code.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

Re: make a datareport with condition

 
0
  #7
Nov 10th, 2008
I need help. please help me with details.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

Re: make a datareport with condition

 
0
  #8
Nov 14th, 2008
help me
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: make a datareport with condition

 
0
  #9
Nov 15th, 2008
Hi Abu,

Well... Follow these Steps:
Open a Data Project
Add a Connection Object (Configure to your database)
Add A Command Object (Say Command1) And Right-Click
Goto properties and Select Option SQL Statement and Type :
Select * From MyTable Where MyDate Between ? And ?
Click on Apply,
Parameter Tab Is Enabled, Go there..
Set these properties for both Parameters:
DataType = adDBDate
HostDataType =Date (VT_Date)
And Apply,
Save the Project
Now Design the DataReport1 on this Command Object...

In The Calling Form, Place 2 Date Pickers say DTFr and DTTo

Place Command Button And Show the Report like this :

  1. Load DataEnvironment1
  2. With DataEnvironment1
  3. If .rsCommand1.State <> 0 Then .rsCommand1.Close
  4. .Command1 Format(DTFr.Value,"dd-mm-yyyy"), Format(DTTo.Value,"dd-mm-yyyy")
  5. End With
  6. DataReport1.Show


I HOPE IT IS CLEAR..

Regards
Veena
Last edited by QVeen72; Nov 15th, 2008 at 6:39 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 505
Reputation: abu taher is an unknown quantity at this point 
Solved Threads: 25
abu taher's Avatar
abu taher abu taher is online now Online
Posting Pro

Re: make a datareport with condition

 
0
  #10
Nov 16th, 2008
thanks veena its work well.
but I have a few question.
1. Set these properties for both Parameters:
DataType = adDBDate
HostDataType =Date (VT_Date)
if I want to search number then what i need to change?
if need to search name or string then....?
please help me with this question.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 3491 | Replies: 27
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC