I have this which works fine for a grid field on a MAIN form
public function getMainformGridField(theEvent as object, FieldName as string) as variant
dim rowset as object
dim Form as object
Form=theEvent.Source.Model.Parent
rowset=Form.getColumns
getMainformGridField=rowset.getbyName(FieldName).value
end function
have tried this for a subform
public function getSubFormGridField(theEvent as object, FieldName as string) as variant
dim oMainForm as object
dim oColumnList as object
dim oGrid as object
dim theValue as variant
oMainForm=theEvent.Source.Model.Parent
oGrid=oMainForm.getbyName("SubForm_Grid")
oColumnList = oGrid.getByName(FieldName)
theValue=oColumnList.getCurrentValue()
getSubFormGridField=theValue
end function
But it fails at the oColumnList assignment.
Can anyone help with the correct code please?