I doubt anyone's run into this before but I thought I'd throw it out there
anyway.

I have a class with a property that returns a date value. The issue is that
retrieving the property value converts it into an integer for some reason.

Suppose I have a bit of code as below:

Dim objBid
Set objBid = New Bid
objBid.Test

Class Bid
Private m_ExpirationDate

Private Sub Class_Initialize()
m_ExpirationDate = #11/1/2006#
End Sub

Public Property Get ExpirationDate()
ExpirationDate = m_ExpirationDate
End Property

Public Sub Test()
MsgBox "ExpirationDate = " & ExpirationDate & ", VarType = " & VarType(ExpirationDate)
MsgBox "m_ExpirationDate = " & m_ExpirationDate & ", VarType = "
& VarType(m_ExpirationDate)
End Sub
End Class

So in my real code, the test method would report, "ExpirationDate = 1, VarType
= 2" for the first message box.
The second would correctly report the date value.
Accessing the property from outside the class would report correctly as well.
The actual code is retrieving and assigning m_ExpirationDate from an ADO
recordset. I have a feeling this is some kind of strange variant conversion
issue but I could not reproduce it outside of the actual environment. (i.e.
above code)

There are obvisouly so many workarounds and so I'm just curious as to what
is going on.

Jiho Han
Senior Software Engineer
Infinity Info Systems
The Sales Technology Experts
Tel: 212.563.4400 x216
Fax: 212.760.0540
jhan@infinityinfo.com
www.infinityinfo.com

Re: Strange behavior re: class property by dNagel

dNagel
Fri Nov 10 15:20:27 CST 2006

I get the identical result for both checks... datatype 7.

D.

Re: Strange behavior re: class property by Anthony

Anthony
Mon Nov 13 15:00:21 CST 2006


"Jiho Han" <jihohan@yahoo.com> wrote in message
news:a19ab9b6361a58c8d2d36af69b8a@msnews.microsoft.com...
> I doubt anyone's run into this before but I thought I'd throw it out there
> anyway.
>
> I have a class with a property that returns a date value. The issue is
that
> retrieving the property value converts it into an integer for some reason.
>
> Suppose I have a bit of code as below:
>
> Dim objBid
> Set objBid = New Bid
> objBid.Test
>
> Class Bid
> Private m_ExpirationDate
>
> Private Sub Class_Initialize()
> m_ExpirationDate = #11/1/2006#
> End Sub
>
> Public Property Get ExpirationDate()
> ExpirationDate = m_ExpirationDate
> End Property
>
> Public Sub Test()
> MsgBox "ExpirationDate = " & ExpirationDate & ", VarType = " &
VarType(ExpirationDate)
> MsgBox "m_ExpirationDate = " & m_ExpirationDate & ", VarType = "
> & VarType(m_ExpirationDate)
> End Sub
> End Class
>
> So in my real code, the test method would report, "ExpirationDate = 1,
VarType
> = 2" for the first message box.
> The second would correctly report the date value.
> Accessing the property from outside the class would report correctly as
well.
> The actual code is retrieving and assigning m_ExpirationDate from an ADO
> recordset. I have a feeling this is some kind of strange variant
conversion
> issue but I could not reproduce it outside of the actual environment.
(i.e.
> above code)
>
> There are obvisouly so many workarounds and so I'm just curious as to what
> is going on.
>

I don't get his behaviour. It works fine for me.



> Jiho Han
> Senior Software Engineer
> Infinity Info Systems
> The Sales Technology Experts
> Tel: 212.563.4400 x216
> Fax: 212.760.0540
> jhan@infinityinfo.com
> www.infinityinfo.com
>
>