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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calender Selection 1

Status
Not open for further replies.

sun11

Programmer
Dec 22, 2009
21
0
0
GB
Hi,

I have used Olecontrol for the calender. I have to select the dates from the calender and display the records from the table . but when i try to do iam not able to display the dates from the table.

thanks
 
Are you getting any error message?

Have you confirmed by using the TRACE & WATCH/DEBUG window that the Date value utilized is correct?

Typically code something like this works fine:
Code:
dThisDate = TTOD(ThisForm.oleDate._VALUE)

SELECT MyTable
SET FILTER TO TblDate = dThisDate
GO TOP
ThisForm.Grid1.Refresh

Although using a FILTER can make things slow.

Good Luck,
JRB-Bldr
 
Keep in mind the calendar control can return a DateTime value. So if you're doing an exact match on your table dates and they are either Date type or DateTime type, you may have to extract just the date portion of the table value and the calendar value.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Keep in mind the calendar control can return a DateTime value.

I agree with Dave's comment.

That's why in my simplistic example code I showed the use of a TTOD() command to convert the value from a DateTime to a Date value.

Hopefully we will hear back from sun11 so that we can get clarification and, consequently, help them better.

Good Luck,
JRB-Bldr
 
Paul Mrozowski has a great calendar class with tons of nice neat features.

been using it in our POS for over a year and i love it.


comes with source codes.


Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Sun11,

Could you explain in a bit more details exactly what the problem is. You say you are "not able to display the dates from the table". How are trying to do that? In what way is it failing?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hi mike,

I have a form in in which i can search for title and a publisher and iam able to do that.. Every book has a published date so i have used olecontrol for the calender and i select a date from ... and date to... so i need to get the details of the books which were published in those dates.. ??
i have recently started foxpro i.e 1 week so not able to get the dates selected

Thanks,
Sun11
 
Hi jrbbldr,

Sorry for late reply i have a basic knowledge on foxpro..
i tried your code but iam not able to select the dates and when i select the dates iam not able to display the records from the table

Thanks,
sun11
 
Sun11,

Have you set the control's ControlSource property to point to the PublishedDate field? If so, the correct date should appear in the control when you refresh the form (after moving to a different record). The date should appear both in the "text" area of the control and in the actual calendar when the user opens it.

Also, when the user edits the date, the new date should automatically get written back to the table.

By the way, I assume the control you are using is "Microsoft Date and Time Picker Control 6.0 (SP2)". There are several variations of the calendar control, but that's the one that is usually used with VFP.

One other point. The control doesn't work properly with blank dates. If you have any blank dates of publication in your table, you might need to take some special action to deal with that. But let's get the basic problem sorted first.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Sun11 - OK you are new to Foxpro.
Welcome to our community.
Well it is time that you learned how to check code using the TRACE window.

From within the VFP development environment if you want to BREAK code and automatically open the TRACE window you enter the code line SET SET ON

Then, when you run the FORM, etc. from the Command Window the TRACE window will open when that code it executed.

From there you can use the WATCH window to see variable values and/or you can manually execute code in the VFP command window to check the consequences.

Now, within the Calendar object's Change Event method you can put that code and see what you are getting with the TTOD() command.

One other thought is that the values from the Calendar object may not be 'seen' by the other methods, due to variable 'encapsulation' with forms, unless you:
1. Put the value into a Form property and retrieve it when needed (best approach).
2. Retrieve the value dynamically from the object itself in your method when needed.
3. You set a variable PUBLIC to contain the value.

NOTE to other Gurus - so as to prevent lengthy dialog on the term -- my use of the word 'encapsulation' is again my own terminology. It refers to variables not being automatically scoped across all methods within a form.

Let us know.

Good Luck,
JRB-Bldr
 
hi JRB-Bldr,

Iam able to get the details when i select the date.
thanks a lot
sun11
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top