ActiveX Date Picker problem

stanmurphy
stanmurphy used Ask the Experts™
on
I have a form with a private data session. There are two date pickers, oleControl1 and Olecontrol2.

I've checked both the form and the date controls and all properties are set to default. There is no code modifying or accessing the date pickers other than what I've attached.

The problem is that when I run this code, dSEARCHDATE1 end up with a date while dSEARCHDATE2 ends up as (  /  /  ).

Both the date pickers are displaying dates when the code is run.

Does anyone know why this is happening?

Thank you.
LOCAL nCOUNTER, nAPPT_NOT_COMPLETE, nARRAY_ROW, nARRAY_COL, nBAD_APPT_COUNTER, dSEARCHDATE1, dSEARCHDATE1

STORE 1 TO nARRAY_ROW, nARRAY_COL
STORE 0 TO nBAD_APPT_COUNTER
STORE "" TO dSEARCHDATE1, dSEARCHDATE2
STORE .T. TO lAPPT_NOT_COMPLETE

DIMENSION aINCOMPLETE_APPT(2000,2)

STORE CTOD(ALLT(STR(THISFORM.OLECONTROL1.OBJECT.Day))+"/"+ALLTRIM(STR(THISFORM.OLECONTROL1.OBJECT.Month))+"/"+ALLTRIM(STR(THISFORM.OLECONTROL1.OBJECT.Year))) TO dSEARCHDATE1
STORE CTOD(ALLT(STR(THISFORM.OLECONTROL2.OBJECT.Day))+"/"+ALLTRIM(STR(THISFORM.OLECONTROL2.OBJECT.Month))+"/"+ALLTRIM(STR(THISFORM.OLECONTROL2.OBJECT.Year))) TO dSEARCHDATE2

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
To clarify, I'm running VFP9 SP2.

Author

Commented:
I suppose I should mention that this code resides in the Click event of a button on the form.

And that the OleControl objects were picked from the OLE button on Foxpro's Toolbox buttonbar.
The only reason could be invalid date format (check your SET DATE settings) or something wrong with the second Ole control - remove it from the form and create it again.

To store the date you should rather use following formula:

STORE DATE(THISFORM.OLECONTROL2.Year, THISFORM.OLECONTROL2.Month, THISFORM.OLECONTROL2.Day) TO ...

which is independent on the DATE settings.

Author

Commented:
Thank you. You're solution as to how to store the date properly worked perfectly. That was the problem. Thank you!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial