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.

Recommended Answers

All 2 Replies

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
salesdatewise.Show
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.

Regards

Silversurf

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.