DTPickers not remembering values

V

Veggatron

on my customized task i have 3 datepickers, one for the start-date
end-date and visit-date. when assigning a date to each of the control
it won't remember anything when i save.
this is the code:


Code
-------------------


Option Explicit

Dim mobjOptButControls
Dim dtpickerStartDate
Dim dtpickerEndDate
Dim dtpickerBezoekDatum

...


Function Item_Open()

Dim objInsp

Set objInsp = Item.GetInspector
objInsp.ShowFormPage("Bezoekrapport")
objInsp.SetCurrentFormPage("Bezoekrapport")

Set mobjOptButControls = objInsp.ModifiedFormPages("Bezoekrapport").Controls
Set txtDatumGereed = mobjOptButControls("DatumGereed")
Set txtDatumGereed2 = mobjOptButControls("DatumGereed2")
Set txtDatumGereed3 = mobjOptButControls("DatumGereed3")
Set txtDatumGereed4 = mobjOptButControls("DatumGereed4")
Set txtDatumGereed5 = mobjOptButControls("DatumGereed5")
Set txtDatumGereed6 = mobjOptButControls("DatumGereed6")
Set dtpickerStartDate = mobjOptButControls("DTPicker1")
Set dtpickerEndDate = mobjOptButControls("DTPicker2")
Set dtpickerBezoekDatum = mobjOptButControls("DTPicker3")

' check if the item is new

If Item.Size = 0 then
dtpickerStartDate.Value = Now()
dtpickerEndDate.Value = Now()
dtpickerBezoekDatum.Value = Now()

' i assume somthing goes wrong here, tho it won't save 1-1-4051 as a date either

else
If Item.Userproperties("StartDate") = "1-1-4051" then
Msgbox Item.Userproperties("StartDate")

else
dtpickerStartDate.Value = Item.Userproperties("StartDate")
dtpickerEndDate.Value = Item.Userproperties("EndDate")
dtpickerBezoekDatum.Value = Item.Userproperties("BezoekDatum")

End If

End If

ReadRegisterTaak()
WriteRegisterClean()

Set objInsp = Nothing

End Function

...

Function Item_Close()

' msgbox dtpickerStartDate.Value
' msgbox dtpickerEndDate.Value
' msgbox Item.Userproperties("Start Date")
' msgbox Item.Userproperties("End Date")

Item.Userproperties("StartDate") = dtpickerStartDate.Value
Item.Userproperties("EndDate") = dtpickerEndDate.Value
Item.Userproperties("BezoekDatum") = dtpickerBezoekDatum.Value

msgbox Item.Userproperties("BezoekDatum")

' msgbox Item.Userproperties("Start Date")
' msgbox Item.Userproperties("End Date")

End Function



-------------------


when saving my task i'm told that the error (objectvariable no
assigned/defined) is in the line
"Item.Userproperties("StartDate") = dtpickerStartDate.Value"

when re-opening my saved task it gives an error on
" msgbox Item.Userproperties("BezoekDatum")" again with objectvariabl
not assigned/defined (not sure whether the dutch translation i
assigned or defined)

thnx in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top