By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,967 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,967 IT Pros & Developers. It's quick & easy.

Run-time error '6' Overflow

P: n/a
I am wondering if anyone can help me out. I have an Access Database that
has been running since forever. Now when I try to open a form I get the
"Run-time error '6' Overflow message and a window asking me to debug or
end. Here is what i see on debug:

Private Sub CmdPeopleAdd_Click()
Dim db As Database
Dim Rs As Recordset
Set db = CurrentDb
Dim SQL As String
Dim i As Integer
Set db = CurrentDb
SQL = "SELECT ID FROM Clients ORDER BY ID;"
Set Rs = db.OpenRecordset(SQL)
Rs.MoveLast
i = Rs!ID + 1 ' Increment the number by one
Rs.AddNew
Rs!ID = i
Rs.Update
Rs.Close
db.Close
DoCmd.OpenForm "FrmPeople", , , , , , i
End Sub

The highlighted area to debug is i = Rs!ID + 1 ' Increment the number by
one.

Thank you,
sf

*** Sent via Developersdex http://www.developersdex.com ***
Feb 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Steve Fraser" <sf*****@tay.com> wrote in message
news:fE***************@news.uswest.net...
I am wondering if anyone can help me out. I have an Access Database that
has been running since forever. Now when I try to open a form I get the
"Run-time error '6' Overflow message and a window asking me to debug or
end. Here is what i see on debug:

Private Sub CmdPeopleAdd_Click()
Dim db As Database
Dim Rs As Recordset
Set db = CurrentDb
Dim SQL As String
Dim i As Integer
Set db = CurrentDb
SQL = "SELECT ID FROM Clients ORDER BY ID;"
Set Rs = db.OpenRecordset(SQL)
Rs.MoveLast
i = Rs!ID + 1 ' Increment the number by one
Rs.AddNew
Rs!ID = i
Rs.Update
Rs.Close
db.Close
DoCmd.OpenForm "FrmPeople", , , , , , i
End Sub

The highlighted area to debug is i = Rs!ID + 1 ' Increment the number by
one.

Thank you,
sf


I guess you have now added so many clients that the number can no longer be
held by an integer. Changing the line
Dim i As Integer
to
Dim i As Long
should fix the immediate problem. There are other comments we could make on
the code, but get that bit fixed first.
Feb 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.