tags:

views:

35

answers:

2

Dear Expert i have the following problem when i try to get the value from the record set it showing error the query is

SSql = "select doj,dol,employeeid from m_employee where employeeid='" & Trim(RsCardNo!Code) & "'" rsCardRepl.Open SSql, Conn, adOpenDynamic, adLockOptimistic
If rsCardRepl.RecordCount > 0 Then Dim temp As Integer temp = Trim(rsCardRepl!employeeId) rsAddPunch!PAYCODE = temp End If

Then the following line giving the error

temp = Trim(rsCardRepl!employeeId)

The error Number=6 Error Description =Overflow

Would please explain me why this error is coming and what is the solution

Thanks Naval Kishor Pandey

A: 

Perhaps you need to define temp like this Dim temp As Long

In simple terms, an overflow error means that the value won't fit into the variable.

  • A VB6 Integer can take values from -32,768 to 32,767
  • A Long can take values from -2,147,483,648 to 2,147,483,647
MarkJ
when i had seen the value in the record set through debugging is 000849 and the data type of the column employeeid is int so their is no means of overflow.
naval
I would also try removing the Trim. Change `temp = Trim(rsCardRepl!employeeId)` into `temp = rsCardRepl!employeeId` That Trim is forcing the employeeID to be converted into a String and then back to an Integer
MarkJ
Hi markj i had also try with dim temp as string and then temp = Trim(rsCardRepl!employeeId) but still i am geting the same error.
naval
+2  A: 

try with cursor type adOpenForwardOnly and lock type adLockReadOnly

AsifQadri