Weird Overflow
I know this is the .net forums, but I don't know where else to turn, please help.
I have a class in vb6 and I keep getting an overflow error, please help.
strDateCreated = VBA.Format$(strNewValue, "MMDDYYYY")
Explanation: strDateCreated is a private variable in my class. The actual property is:
public property get datecreated() as string
datecreated=strdatecreated
end property
public property let datecreated(strNewValue) as string
strDateCreated=VBA.Format$(strNewValue, "MMDDYYYY") '//this is the line that causes the overflow error.
end property
In a form module I have:
if nt.datecreated="" then nt.datecreated= Now
Thanks in advance
[708 byte] By [
bud1024] at [2007-12-16]
Its been a while since I used VB6 and I don't have it installed in front of me, but here are a few of my observations:
1. I believe the format string is usually lower case ("mmddyyyy"). Not sure if its case sensitive though.
2. You might just double check the value of strNewValue after entering that property but before hitting that line just to make sure that it is a string and will actually result in a date. In fact I would add something like IsDate(strNewValue) to guard against passing a bad string to Format$.
3. I'm probably reaching now, but I'd also check to make sure that strDateCreated is declared as a string.
Hope some of that helps.
Regards,
Patrick Baker
Microsoft Visual Basic Deployment & Designer Team
This posting is provided "AS IS" with no warranties, and confers no rights.