Results 1 to 8 of 8
  1. #1
    Danielh1000 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2020
    Posts
    10

    Overflow Error

    Why would this code produce an overflow error at the lvDailyEarnings = 3000*12? This is only 36,000, well within an Long Integer

    Private Sub Form_Open(Cancel As Integer)
    Dim lvDailyEarnings As Long
    '
    lvDailyEarnings = 3000 * 12
    '


    With Me
    .AllowAdditions = False
    .AllowDeletions = False
    .AllowEdits = False
    .LNoEdits.Visible = True
    '
    .txtOneMonth = gcDaysPerMonth
    .LOneMonthExample.Caption = "If an employee... "
    .txtOneYear = gcDaysPerYear
    .LAbsentExample.Caption = "If an employee ..."

    .LAbsentExample1.Caption = "For example..."

    .LOneYearExample.Caption = "If an employee ..."
    End With
    End Sub

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Have you stepped through your code to see exactly where the error occurs?
    Where are you changing the value of lvDailyEarnings?

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Danielh1000 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2020
    Posts
    10
    Quote Originally Posted by Danielh1000 View Post
    Why would this code produce an overflow error at the lvDailyEarnings = 3000*12? This is only 36,000, well within an Long Integer

    Private Sub Form_Open(Cancel As Integer)
    Dim lvDailyEarnings As Long
    '
    lvDailyEarnings = 3000 * 12
    '
    With Me
    .AllowAdditions = False
    .AllowDeletions = False
    .AllowEdits = False
    .LNoEdits.Visible = True
    '
    .txtOneMonth = gcDaysPerMonth
    .LOneMonthExample.Caption = "If an employee... "
    .txtOneYear = gcDaysPerYear
    .LAbsentExample.Caption = "If an employee ..."

    .LAbsentExample1.Caption = "For example..."

    .LOneYearExample.Caption = "If an employee ..."
    End With
    End Sub
    pbadly has the answer at...
    https://docs.microsoft.com/en-us/off...erflow-error-6

  5. #5
    Danielh1000 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2020
    Posts
    10
    Brilliant..thanks...here I was thinking my VBA project was corrupt...

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help! By the way, all I did was click on the Help button the error message had on it (after recreating in a test db).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Danielh1000 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Feb 2020
    Posts
    10
    Quote Originally Posted by pbaldy View Post
    Happy to help! By the way, all I did was click on the Help button the error message had on it (after recreating in a test db).
    Huummmm...now I feel stupid.... -! Thanks again....

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by Danielh1000 View Post
    now I feel stupid
    Don't. Sometimes we all miss the forest for the trees.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error: overflow.
    By Homegrownandy in forum Programming
    Replies: 6
    Last Post: 05-02-2019, 02:47 AM
  2. Overflow Error
    By jtm013 in forum Programming
    Replies: 15
    Last Post: 01-07-2015, 01:01 PM
  3. Overflow Error
    By pj33558 in forum Reports
    Replies: 1
    Last Post: 06-19-2014, 10:50 AM
  4. Overflow Error
    By mike02 in forum Programming
    Replies: 14
    Last Post: 07-12-2013, 10:53 AM
  5. OverFlow Error.
    By Coffee in forum Import/Export Data
    Replies: 5
    Last Post: 08-17-2011, 05:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums