runtime error 6: Overflow

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could use some help on this one...

Have a fairly large, previously working Access 2K database running on XP Pro
machine. Recently made minor change to one of the forms, added two named
queries, and added three new fields to two tables. Afterward, when I run one
of the program's routines (to print a report with a bunch of imbedded
subreports), I get a "Runtime Error 6 - Overlfow" on a statement in the code
for one of the subreports. Here is the code:

Private Sub SetFormats(Optional fmtType As String)
Dim fmtMon As String
Dim fmtDate As Integer
Dim x As Long

If IsMissing(fmtType) Then fmtType = "Regular"

fmtDate = #1/1/2001# 'THIS LINE HIGHLIGHTED IN DEBUG
For x = 1 To 12
....

(Not so) Funny thing is, the recent changes are not related in any way to
the subreport whose code is being executed. The error is repeatable, and
always occurs in the same place in the code.

Tried Compact & Repair, and even creating a new database and importing all
of the objects (this sometimes works for odd Access problems) but it didn't
help. MS Knowledge Base was of no help at all (So what's new?).

Any guesses on how to fix?

Thanks,
Bruce
 
Try

Dim fmtDate As Date

Dates are stored as 8 byte floating point numbers, where the integer portion
represents the date as the number of days relative to 30 Dec, 1899, and the
decimal portion represents the time as a fraction of a day. January 1st,
2001 happens to be 36,892 days since 30 Dec, 1899, and that's too large a
value to store in an Integer: they can only store values between -32,768 and
32,767.
 
Thanks, Doug.

This one had been running so long that I didn't notice that the Dim had been
changed. (The next one had been changed, too.) There's only two of us that
work on it. Probably his idea of a Friday afternoon joke.

Know anyone who breaks knees in their off time?

Bruce
 
Back
Top