Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DT Picker 1

Status
Not open for further replies.

mccartmd

Programmer
Feb 3, 2003
63
US
Hi:
Have two DTPicker OLECONTROLs on a form whereby the user picks
calender Start and End Dates from each.
Want to run a query into view "vPrices" filtering records for start and end dates. My view vPrice has: date_recorded field
like:
vPrices.date_recorded type DateTime 8
For example:
01/15/2012 08:01:58 AM

I set up varibles to capture the Calendar picks. . .in the activate of the form and refreshing accordingly.

PUBLIC vMonthStart,vMonthEnd,vDayStart,vDayEnd,vYearStart,vYearEnd
vMonthStart = thisform.olecontrol1.Month
vMonthEnd = thisform.olecontrol1.day
vDayStart = thisform.olecontrol1.Year
vDayEnd = thisform.olecontrol2.Month
vYearStart = thisform.olecontrol2.day
vYearEnd = thisform.olecontrol2.Year

How do I capture the Olecontrol values to use them in my "vPrice' view and filter in the vPrice view for only those days inclusive for the period choosen?

When run messageboxes I get these values
*!* MESSAGEBOX(vMonthStart) && Shows 1 which is Jan
*!* MESSAGEBOX(vMonthEnd) && Shows 2 which is Feb
*!* MESSAGEBOX(vDayStart) && Shows 15 whicn is Jan 15
*!* MESSAGEBOX(vDayEnd) && Shows 28 which is Feb 28
*!* MESSAGEBOX(vYearStart) && Shows 2012 which is the year
*!* MESSAGEBOX(vYearEnd) && Shows 2012 which is the year

&&&& Code I have tried
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SELECT vPrices && View of All Prices
SET FILTER TO date_recorded => vMonthStart and date_recorded =< vMonthEnd and date_recorded => vDayStart and date_recorded =< vDayEnd and date_recorded => vYearStart and date_recorded =< vYearEnd
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Thank you for any help.
Michael
 
did a search and found answer at Holm78, Mike Lewis' is a hero!!
Feb 18, 2004. . .7 year ago. . .


with thisform.MyDtPicker
MyValue = DATE(.Year, .Month, .Day)
endwith

. . .the cat' meow

Thx

Mike
 
A more simple approach might be something like:
Code:
vStartDate = TTOD(thisform.olecontrol1._Value)
vEndDate = TTOD(thisform.olecontrol2._Value)

SELECT vPrices && View of All Prices
SET FILTER TO BETWEEN(date_recorded, vStartDate, vEndDate)
<do whatever>

Good Luck,
JRB-Bldr
 
thank you JRB, I added 1 to vEndDate like vEndDate +1 to be inclusive of the "last" day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top