| | |
make a datareport with condition
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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.
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.
>> 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.
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.
hi. you try to make a query first.say
then set the record source of the report
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
rs.Open "Select appdate, name from tablename where appdate between '" & date1 & "' AND '" & date2 & "'"
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Set repo.DataSource = rs repo.Title = "Hello" repo.Show
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 :
I HOPE IT IS CLEAR..
Regards
Veena
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 :
vb Syntax (Toggle Plain Text)
Load DataEnvironment1 With DataEnvironment1 If .rsCommand1.State <> 0 Then .rsCommand1.Close .Command1 Format(DTFr.Value,"dd-mm-yyyy"), Format(DTTo.Value,"dd-mm-yyyy") End With DataReport1.Show
I HOPE IT IS CLEAR..
Regards
Veena
Last edited by QVeen72; Nov 15th, 2008 at 6:39 am.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Simple Excel Macro (VBA)
- Next Thread: Minimize a form in its own window Like Photoshop
Views: 3491 | Replies: 27
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection copy creat ctrl+f data database datareport date delete dissertations dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






