0

Greetings!

I have database file with dateformat on a field.

I want to view the data on files according to its date range using vb6.

Like for example i want to view a file for starting date = 23/10/2007 upto 23/11/2007. Range of date is one month from starting date upto ending date.

I try the

syntax

my variable my field my 2nd variabled my field
...........|..................|....................|...........................|
if ((varstartdate >= fielddate) and (varenddate <= fielddate)) then
viewdata
endif

but it doesn't works.

Anybody have idea to view this file according to date range.

Thank you in advance

4
Contributors
3
Replies
7
Views
9 Years
Discussion Span
Last Post by kehar
0

Try using the DateDiff function:

Dim TheDate As Date ' Declare variables.
Dim Msg
TheDate = InputBox("Enter a date")
Msg = "Days from today: " & DateDiff("d", Now, TheDate)
MsgBox Msg

0

Write the following code
Pvt command1_click()
rs.open "Select * from <table name> where < field name> >= cdate('" & datepicker1.value & "') and <= cdate('" & datepicker2.value & "'),cn, adlockstatic, alockoptimistic,
endsub

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.