473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error message "Overflow" - what does it mean

Dear Group

I am trying to automate process of adding a new record id in my form using
the following code when the user clicks the "Add New Record" button. For
example if the last record id is "2005001" then I want to increment this by
one so that new value is "2005002" and place it in the record id field for
the new record on the form. I've tried using the following code but get the
message "Overflow" when I run the code. Can't find on the online help what
this means. Not sure if the logic is correct in the code? Any pointers or
ideas would be much appreciated.

Code:
On Error GoTo Err_Command623_Click
Dim intlastrecID As Integer

DoCmd.GoToRecord , , acLast
intlastrecID = PropID.Value
DoCmd.GoToRecord , , acNewRec
PropID.Value = intlastrecID + 1

Exit_Command623_Click:
Exit Sub

Err_Command623_Click:
MsgBox Err.Description
Resume Exit_Command623_Click
Many thanks in advance
Nov 13 '05 #1
2 17481
Overflow means the number is too great for the type of variable.

Integers go up to 32767 only.
Replace the declaration line with a long, e.g.:
Dim lngLastRecId As Long

If the form was filtered or sorted differently, the last record could
contain a value that is not the highest. Also, if there are no records, the
assignment of a Null to an Integer or Long will fail. Safer to lookup the
highest number yet assigned directly in the table, and this avoids jumping
around the records as well:
lngLastRecId = Nz(DMax("PropId", "Table1"), 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Andy Davis" <ad******@westnet.com.au> wrote in message
news:42********@quokka.wn.com.au...
Dear Group

I am trying to automate process of adding a new record id in my form using
the following code when the user clicks the "Add New Record" button. For
example if the last record id is "2005001" then I want to increment this
by one so that new value is "2005002" and place it in the record id field
for the new record on the form. I've tried using the following code but
get the message "Overflow" when I run the code. Can't find on the online
help what this means. Not sure if the logic is correct in the code? Any
pointers or ideas would be much appreciated.

Code:
On Error GoTo Err_Command623_Click
Dim intlastrecID As Integer

DoCmd.GoToRecord , , acLast
intlastrecID = PropID.Value
DoCmd.GoToRecord , , acNewRec
PropID.Value = intlastrecID + 1

Exit_Command623_Click:
Exit Sub

Err_Command623_Click:
MsgBox Err.Description
Resume Exit_Command623_Click
Many thanks in advance

Nov 13 '05 #2
Dear Allen

Many thanks for the advice. It would have taken me a fair few hours of
poring thro' my VB books. I am a bit rusty with VB at the moment after a 2-3
year break from VBA coding. Again thanks for that. It worked a beaut!

Dawn Davis

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:42***********************@per-qv1-newsreader-01.iinet.net.au...
Overflow means the number is too great for the type of variable.

Integers go up to 32767 only.
Replace the declaration line with a long, e.g.:
Dim lngLastRecId As Long

If the form was filtered or sorted differently, the last record could
contain a value that is not the highest. Also, if there are no records,
the assignment of a Null to an Integer or Long will fail. Safer to lookup
the highest number yet assigned directly in the table, and this avoids
jumping around the records as well:
lngLastRecId = Nz(DMax("PropId", "Table1"), 0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Andy Davis" <ad******@westnet.com.au> wrote in message
news:42********@quokka.wn.com.au...
Dear Group

I am trying to automate process of adding a new record id in my form
using the following code when the user clicks the "Add New Record"
button. For example if the last record id is "2005001" then I want to
increment this by one so that new value is "2005002" and place it in the
record id field for the new record on the form. I've tried using the
following code but get the message "Overflow" when I run the code. Can't
find on the online help what this means. Not sure if the logic is correct
in the code? Any pointers or ideas would be much appreciated.

Code:
On Error GoTo Err_Command623_Click
Dim intlastrecID As Integer

DoCmd.GoToRecord , , acLast
intlastrecID = PropID.Value
DoCmd.GoToRecord , , acNewRec
PropID.Value = intlastrecID + 1

Exit_Command623_Click:
Exit Sub

Err_Command623_Click:
MsgBox Err.Description
Resume Exit_Command623_Click
Many thanks in advance


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Spook | last post by:
Running a particular Access report or the query associated with it brings up the warning "Overflow". What does this mean? WhatI have I done wrong? Both report and query were fine before lunch...
3
by: SheldonMopes | last post by:
I sometimes get a pop-up box that reads "Overflow" and the module that is executing pauses. It doesn't get caught by my error trapping, and it seems to be randow. By random, I mean usually in the...
5
xxoulmate
by: xxoulmate | last post by:
help on progress bar on error: "overflow" is the message., what is the cause of error., the progressbar value basis on the second(time) progressbar max value = 59 progressbar min value = 0
0
by: snowdream1982 | last post by:
Dear all, I hit an error OVERFLOW but when I insert the sql statement below manually in the SQLEditor, it goes well, no errors at all. My coding: SQLInsertTempMf = "INSERT INTO tempmf " &...
1
by: rileyjane | last post by:
Hello, I am running a Union query in Access 2003 that combines two other queries. When I run each query individually, they open fine with no problems. But when I try to run the Union query, I...
2
by: johnwaddy | last post by:
I'm clueless to the problem, I have a couple of account with 300+ records and all of a sudden when you recalc it reaches record 256 and pops up this "Overflow" error. I do not have any issues with...
30
by: Medvedev | last post by:
i see serveral source codes , and i found they almost only use "new" and "delete" keywords to make they object. Why should i do that , and as i know the object is going to be destroy by itself at...
1
by: Tami Robinson | last post by:
I keep getting !Overflow error when running this query: SELECT DISTINCTROW FamilyInfo.FamilyInfoID ,...
1
by: Amy Badgett | last post by:
I keep getting the error: "Overflow" with this piece of MS Access SQL coding: SELECT DISTINCT (SELECT Count(tblCallLog.tblCallLog_gospelPresented) FROM tblCallLog WHERE...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.