overflow error running db.execute

  • Thread starter Thread starter Steven Scaife
  • Start date Start date
S

Steven Scaife

My code is below it errors on the isnert into Payment_Merge line. I get
overflow error returned. I have tried opening the recordset without the
dbopenforward only and tried the insert statement with ' and without '
quotes around the values. I have also tried debugging.print the sql
statement when i had it as a string but got overflow error then. The values
i am inserting are number values and as far as i know numbers dont have the
single quotes. If any more information is needed please let me know, thanks
for any help

If cboPayMethod.Value = "Credit Card" Then
MsgBox "running the CCard Code"
strsql = "SELECT TOP 1 Payment_ID FROM Payment ORDER BY Payment_ID
DESC;"
Set rs = db.OpenRecordset(strsql, dbOpenForwardOnly)

db.Execute "INSERT INTO Payment_Merge (Payment_ID, Card_Number)
Values ('" & CInt(rs!Payment_ID) & "', '" & CInt(Me.txtCard) & "');",
dbFailOnError

strCardInfo = "INSERT INTO Card_Info (Card_Number, Card_Type, " _
& "Issue_Number, Expiry_Date) VALUES (" _
& CInt(Me.txtCard) & ", '" & Me.cboCardType & "', " &
CInt(Me.txtIssue) & ", '" & Me.txtExpiry & "');"
Debug.Print strCardInfo
MsgBox "Executing 2nd string"
db.Execute strCardInfo, dbFailOnError
Else
MsgBox "CCard code not run"
End If
 
What are the data for Payment_ID, Card_Number in Payment_Merge? What values
are you getting for rs!Payment_ID and Me.txtCard? If your numbers are
Integer, for instance, they're limited to values between -32,768 and 32,767,
while Long Integers are limited to values between -2,147,483,648 and
2,147,483,647
 
Also the error is 3464 datatype mismatch using an error loop i pulled from
the help file.

Its number type long integer the fields i am trying to insert to, so have
swapped the cint to clng but to no avail.
 
thanks i had the txtcard value as number when it should have been text, it
is a field to hold credit card numbers. Changed teh field type to text and
it worked.
 
Back
Top