The GetObjectValue function returns a value that's not a date when you retrieve the date from a control
This article fixes an issue in which the GetObjectValue
function returns a value that's not a date when you try to retrieve the date from a control.
Applies to: Microsoft Dynamics SL 2011
Original KB number: 914849
Symptoms
When you use the GetObjectValue
function to retrieve a date in Microsoft Dynamics SL or in Microsoft Business Solutions - Solomon, the function returns a value that is not a date. This problem occurs when you try to retrieve the date from any control that contains a date.
Cause
This problem occurs because the GetObjectValue
function returns a string value instead of a date value.
Resolution
To resolve this problem, convert the string value to a date value by using the StrToDate
function or the StrToDateSep
function.
The following is a sample of code that retrieves the date as a string value from the cDocDate
control. The code then converts the string value into a date value that contains separators.
Dim strDate As String
Dim dDate As Sdate
dDate.val = GetObjectValue("cdocdate")
strDate = DateToStrSep(dDate)
MsgBox (strDate)