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

dtpicker checkbox

Status
Not open for further replies.

wbehning

Programmer
Nov 14, 2001
47
US
I have dtpicker control with the checkbox enabled. The control source is a date field. If the field is empty or null, I want to programmically set the value to null. However I get the error "Ole IDispatach exception code 0 from dtpicker: Property is read-only. I have tried setting the year,month, and day properties to null, and that does not work either. I have the code below. Does anyone have any ideas on how to do this?

Refresh Method
*** ActiveX Control Method ***
1 IF EMPTY(NVL(v_st1.scheduledshipdate,{}))
2 this.object.Value = null
3 ELSE
4 this.object.year = YEAR(v_st1.scheduledshipdate)
5 this.object.month = MONTH(v_st1.scheduledshipdate)
6 this.object.day = DAY(v_st1.scheduledshipdate)
7 ENDIF

8 this.object.Enabled = !(v_stshippinglog.exportprepared)
 
While I'm on the subject, has anyone had success in utilizing the dtpicker control in a grid?
 
wbehning,

The way I got round this problem was to test for an empty date, and to programmatically remove the control source if this is detected. I do this when I navigate to a new record or refresh the form.

Then, in the control's LostFocus, I take the value from the control, and REPLACE this into the relevant field in the table. If you are using checkboxes, you would skip that step if the checkbox is .F.

I don't know if that's the best way of doing it, but it does work.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top