I have a simple form with a primary collection with a grid tied to a secondary collection. It is kind of like a parent/child relationship. They are linked together by a common key with the primary collection being a summary record and the secondary collection being detail records. I want to be able to change a date field in the primary collection grid and have the date column update in the secondary collection. I have used this method for strings and numeric fields with success, however, but for some reason I am having problems with a date field.
The field is a date field in the SQL table, the IDO Property and the Component.
When changing the date in the primary collection, the secondary collection grid changes (all the rows), however, then I try to save I get the following error.
'9/1/2021' is an invalid value for the MSA_V360_APTrxsIntrmdt.Dist_Date property
Here is the form script:
Sub ChangeDistDate()
Dim oCache As IWSIDOCollection
Dim oCacheSub As IWSIDOCollection
Dim oGrid As IWSFormComponent
Dim oCacheCurRow As Integer
'Dim iSubCurRow As Integer
Dim i As Integer
Dim j As Integer
Dim DistDate As Date
oCache = ThisForm.PrimaryIDOCollection
oCacheCurRow = oCache.GetCurrentObjectIndex() + 1
oCacheSub = ThisForm.Components("V360TransDetailgrid").IDOCollection
oGrid = ThisForm.Components("V360TransDetailgrid")
j = oCacheSub.GetNumEntries - 1
DistDate = CDate(((ThisForm.Components("DistDategridColumn").Value)))
For i = 1 To j
oGrid.SetGridValueByColumnName(i, "APTDistDategridColumn", CStr((DistDate)))
oCacheSub.SetObjectPropertyPlusModifyRefresh("Dist_Date", i, CStr((DistDate)))
Next i
End Sub
Any thoughts or help would be greatly appreciated.
Tim Olig