Overflow (#6) Error When Assigning a Date Data Type

jaunito

New Member
Joined
Jun 10, 2004
Messages
10
I have a class that imports date values from a worksheet and then stores them in a class along with a lot of other information. The problem is when I try to move from the private variable holding the date information to the public property, it is giving me an overflow error. I tested this two days ago (the exact same code) and did not get any errors in execution, so I'm quite confused as to what might be causing it.
VBA Code:
Property Let FlightDate(pd As Date)
pdFlightDate = pd
End Property
Property Get FlightDate() As Date
FlightDate = pdFlightDate
End Property
When I set (let) the date I don't get a problem, but when I try to return the date I'm getting a problem. I'm working in Office 365 on a Mac trying to make it work on the Mac Platform, but I don't think this is a Mac Related issue.
 
How about sharing the code for CFlights? And, where do you initialize wsxNavyList?
Some of that gets into proprietary information that I am not at liberty to divulge, I can share the part that calls it:
VBA Code:
Property Get Item() As String
    Dim s As String
    s = Me.Count & "-"
    s = s & Me.FlightDate & "-"
    s = s & Me.Aircraft.Model & "-"
    s = s & Me.TailNum & "-"
    s = s & Me.Route & "-"
    s = s & Me.Duration & "-"
    s = s & Me.Remarks & "-"
    Item = s
End Property
This Item property is called as a key of the collection object that contains multiple CFlight objects.
VBA Code:
colFlights.Add Item:=Flight, key:=Flight.Item
 
Last edited:
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Based only on code fragments, and without knowing your layout, I'm not sure we can help further.

It sounds like the problem is intermittent (Post #6) and I am guessing that you are accidentally capturing a value greater than 2,958,465 (i.e. 31/12/9999) in wsxNavyList. But the overflow error would show up on setting, rather than getting, the .FlightDate property.

You still haven't told us which line of code produces the error?
 
Upvote 0
If you look at #11 above, that is where the code is causing the overflow error, when I'm adding the date to a string so that I can generate a unique key.
VBA Code:
[ICODE]s = s & Me.FlightDate & "-"[/ICODE]
is the actual line that causes the problem. But I understand if you can't help more here. I know that the value going into the pdFlightDate was 6/8/11, so that is why I was so perplexed by the overflow. Not only that but it is going into a string, so it should not cause any issue.

Thanks anyway!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top