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

Access Run Time Error 6 Overflow

P: n/a
I have been using the code below successfully for almost a year.
yesterday, I began getting a run time error 6 (overflow). I am using
the code in an Access 2000 database. Can anyone help me understand
what I can do to correct this?

The error points to the "MaxKey = DLookup("Expr1", "lkqry_Histry_Max#")
+ 1" as the breakpoint.

thanks,

Christy

Option Compare Database
Option Explicit

Private Sub Command11_Click()
Dim MaxKey As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("tbl_History", dbOpenDynaset)

MaxKey = DLookup("Expr1", "lkqry_Histry_Max#") + 1

'Added by Christy Clifton, modified 2/12/05 to pop up message reminding
associate to select a
'request type

If IsNull(Me.Text0) Then
strMsg = "Please Enter Note."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo8) Then
strMsg = "Please Select A Status."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo19) Then
strMsg = "Please Select An Activity Code."
MsgBox strMsg, , "SWAT: Run-Time Error"
'If Me.Combo8 = S3 Or S5 Then
' strMsg = "Please Make Sure You Have Entered A Request
Type."
' MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S3" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S5" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"

Else
rst.AddNew
rst!Auto_Key = MaxKey
rst!App_ID = Me.Text2
rst!Update_Date = Format(Now(), "mm/dd/yyyy")
rst!Status = Me.Combo8
rst!Notes = Me.Text0
rst!User = Forms!frm_Main_Menu!CrtUser
rst!Time = Time
'rst!Resolve_Reason = Me.ResolveReason
rst!Act_Code = Me.Combo19
rst.Update
db.Execute "update tbl_EMAIL_Data set status='" & Me.Combo8 &
"' where app_id='" & Me.Text2 & "'"
db.Execute "update tbl_EMAIL_Data set Last_Updated='" &
Format(Now(), "mm/dd/yyyy") & "' where app_id='" & Me.Text2 & "'"

If CurrentProject.AllForms("frm_EditRecord").IsLoaded = True Then
Forms!frm_EditRecord!Notes.Requery
DoCmd.Close
End If

End Sub

Private Sub Command12_Click()
DoCmd.Close
End Sub

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You have MaxKey declared as an INTEGER. Change it to LONG

--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast/

"Christaaay" <ch*************@capitaloneauto.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have been using the code below successfully for almost a year.
yesterday, I began getting a run time error 6 (overflow). I am using
the code in an Access 2000 database. Can anyone help me understand
what I can do to correct this?

The error points to the "MaxKey = DLookup("Expr1", "lkqry_Histry_Max#")
+ 1" as the breakpoint.

thanks,

Christy

Option Compare Database
Option Explicit

Private Sub Command11_Click()
Dim MaxKey As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("tbl_History", dbOpenDynaset)

MaxKey = DLookup("Expr1", "lkqry_Histry_Max#") + 1

'Added by Christy Clifton, modified 2/12/05 to pop up message reminding
associate to select a
'request type

If IsNull(Me.Text0) Then
strMsg = "Please Enter Note."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo8) Then
strMsg = "Please Select A Status."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo19) Then
strMsg = "Please Select An Activity Code."
MsgBox strMsg, , "SWAT: Run-Time Error"
'If Me.Combo8 = S3 Or S5 Then
' strMsg = "Please Make Sure You Have Entered A Request
Type."
' MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S3" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S5" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"

Else
rst.AddNew
rst!Auto_Key = MaxKey
rst!App_ID = Me.Text2
rst!Update_Date = Format(Now(), "mm/dd/yyyy")
rst!Status = Me.Combo8
rst!Notes = Me.Text0
rst!User = Forms!frm_Main_Menu!CrtUser
rst!Time = Time
'rst!Resolve_Reason = Me.ResolveReason
rst!Act_Code = Me.Combo19
rst.Update
db.Execute "update tbl_EMAIL_Data set status='" & Me.Combo8 &
"' where app_id='" & Me.Text2 & "'"
db.Execute "update tbl_EMAIL_Data set Last_Updated='" &
Format(Now(), "mm/dd/yyyy") & "' where app_id='" & Me.Text2 & "'"

If CurrentProject.AllForms("frm_EditRecord").IsLoaded = True Then
Forms!frm_EditRecord!Notes.Requery
DoCmd.Close
End If

End Sub

Private Sub Command12_Click()
DoCmd.Close
End Sub

Nov 13 '05 #2

P: n/a
just LONG or LONGINTEGER?

Nov 13 '05 #3

P: n/a
I think the syntax is Long, but it does stand for Long Integer.
If you have been using this code for some time, you may have
exceeded the 32000 (yeah, that's not exact) limit for integers
and simply need the variable to match the table field data type.

--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com/datafast/

"Christaaay" <ch*************@capitaloneauto.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
just LONG or LONGINTEGER?

Nov 13 '05 #4

P: n/a
Redefine MaxKey as a long, I would guess you've exceeded the maximum value
for an integer.

--
Terry Kreft

"Christaaay" <ch*************@capitaloneauto.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have been using the code below successfully for almost a year.
yesterday, I began getting a run time error 6 (overflow). I am using
the code in an Access 2000 database. Can anyone help me understand
what I can do to correct this?

The error points to the "MaxKey = DLookup("Expr1", "lkqry_Histry_Max#")
+ 1" as the breakpoint.

thanks,

Christy

Option Compare Database
Option Explicit

Private Sub Command11_Click()
Dim MaxKey As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("tbl_History", dbOpenDynaset)

MaxKey = DLookup("Expr1", "lkqry_Histry_Max#") + 1

'Added by Christy Clifton, modified 2/12/05 to pop up message reminding
associate to select a
'request type

If IsNull(Me.Text0) Then
strMsg = "Please Enter Note."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo8) Then
strMsg = "Please Select A Status."
MsgBox strMsg, , "SWAT: Run-Time Error"
ElseIf IsNull(Me.Combo19) Then
strMsg = "Please Select An Activity Code."
MsgBox strMsg, , "SWAT: Run-Time Error"
'If Me.Combo8 = S3 Or S5 Then
' strMsg = "Please Make Sure You Have Entered A Request
Type."
' MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S3" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"
'ElseIf Me.Combo8 = "S5" Then
'strMsg = "Please Make Sure You Have Entered A Request
Type."
'MsgBox strMsg, , "SWAT: REMINDER"

Else
rst.AddNew
rst!Auto_Key = MaxKey
rst!App_ID = Me.Text2
rst!Update_Date = Format(Now(), "mm/dd/yyyy")
rst!Status = Me.Combo8
rst!Notes = Me.Text0
rst!User = Forms!frm_Main_Menu!CrtUser
rst!Time = Time
'rst!Resolve_Reason = Me.ResolveReason
rst!Act_Code = Me.Combo19
rst.Update
db.Execute "update tbl_EMAIL_Data set status='" & Me.Combo8 &
"' where app_id='" & Me.Text2 & "'"
db.Execute "update tbl_EMAIL_Data set Last_Updated='" &
Format(Now(), "mm/dd/yyyy") & "' where app_id='" & Me.Text2 & "'"

If CurrentProject.AllForms("frm_EditRecord").IsLoaded = True Then
Forms!frm_EditRecord!Notes.Requery
DoCmd.Close
End If

End Sub

Private Sub Command12_Click()
DoCmd.Close
End Sub

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.