hi. im developing an inventory system. my problem is

i need to create a datareport with date range so i created a query in ms access and i got the result
but to get the result i should run the query first then a dialog box will pop-up to get the

[startdate] and [enddate]

i need to set values of those using DTpicker on vb6.

Edited by fdkallday_1: misinformation

4 Years
Discussion Span
Last Post by AndreRet

in my inventory system I have buil it in datareport through vb 6.0. In datareport I have the follwing SQL statement

select * from tblsales where sdate between ? and ?

where tblsales is my sales table in ms-access. Then I have another from in which I have to dtpicker for startdate and end date. under cmdview buttoin click event i have the following code:

Private Sub cmdview_Click()
Load de1
With de1
If .rscmdsalesdt.State <> 0 Then .rscmdsalesdt.Close
.cmdsalesdt dtpstart.Value, dtpend.Value
End With
End Sub

where de1 is my dataenvironment -1, rscmdsalesdt is my cmdrecordset in datareprot which I stated earlier.

I don't know will it help you or not in Ms-Access, but I find my solution for vb and Ms-Access in this way.




Before you run your query -

Dim startDate As Date, endDate As Date

startDate = dtPicker1.Value
endDate = dtPicker2.Value

''Remember to add error trapping code to check if there are any values returned...

Now run your query

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.