473,387 Members | 1,590 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.

runtime error 6 - overflow

I m having runtime time error 6 - overflow in the following code. Can anyone help me & sort out my problem.



Private Sub cmdSave_Click()
Dim intCounter As Integer
Dim rsData As New ADODB.Recordset
Dim intId As Integer
Dim blnOneOrTwo As Boolean
Dim intPurchId As Integer

If msfGrid.Rows <= 1 Then
MsgError ("No Purchases To Be Saved")
Exit Sub
End If

rsData.Open "Select Max(Id) as MaxId From PurchiMaster", Con, adOpenForwardOnly, adLockReadOnly
If IsNull(rsData("MaxId")) = True Then
intId = 1
Else
intId = Val(rsData("MaxId"))
End If
rsData.Close

rsData.Open "Select Max(PurchId) as MaxId From PurchiMaster", Con, adOpenForwardOnly, adLockReadOnly
If IsNull(rsData("MaxId")) = True Then
intPurchId = 0
ElseIf Val(rsData("MaxId")) = 0 Then
intPurchId = 0
Else
intPurchId = Val(rsData("MaxId"))
End If
rsData.Close

rsData.Open "PurchiMaster", Con, adOpenDynamic, adLockOptimistic

Dim intVal As Integer

intVal = MsgBox("Confirm", vbYesNoCancel)
'MsgBox intVal
If intVal = vbYes Then
blnOneOrTwo = One
ElseIf intVal = vbNo Then
blnOneOrTwo = Two
ElseIf intVal = vbCancel Then
Exit Sub
End If


With msfGrid
For intCounter = 1 To .Rows - 1
rsData.AddNew
intId = intId + 1
intPurchId = intPurchId + 1
rsData("Id") = intId
rsData("PurchId") = intPurchId
rsData("Date") = Format(dtDate.Value, "dd/mm/yyyy")
rsData("Party") = Trim(.TextMatrix(intCounter, 0))
rsData("PurchiNo") = Val(.TextMatrix(intCounter, 1))
rsData("Desc") = Trim(.TextMatrix(intCounter, 2))
rsData("Qty") = Val(.TextMatrix(intCounter, 4))
rsData("Units") = Trim(.TextMatrix(intCounter, 5))
rsData("Rate") = Val(.TextMatrix(intCounter, 6))
rsData("Amount") = Val(.TextMatrix(intCounter, 7))
'after stock updation
rsData("Desc2") = Trim(.TextMatrix(intCounter, 3))
rsData("ItemId") = Val(.TextMatrix(intCounter, 8))
'after stock updation
rsData("Type") = blnOneOrTwo
rsData.Update

Call InsertInPurchiStock(blnOneOrTwo, intCounter, intId)
Next
End With
'rsData.CancelUpdate
rsData.Close

ButtonValue = None

Call Clear(Me)
msfGrid.Rows = 1

Call EditMode(False)

Set rsData = Nothing
dtDate.SetFocus
End Sub
Apr 13 '07 #1
1 7797
Tig201
103 100+
I think this might be your problem

Expand|Select|Wrap|Line Numbers
  1. Dim blnOneOrTwo As Boolean
  2. ....................
  3. blnOneOrTwo = One
  4. ....................
  5. blnOneOrTwo = Two
  6. ....................
  7.  
Try setting “blnOneOrTwo” to True or False or define it as something other than a Boolean.
Apr 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: geekwagon | last post by:
At my job is a dts package that is failing in SQL 2005. I am not a SQL expert. I am just trying to fix. I put the query in Query Analyzer and get this error: (4322 row(s) affected) ...
10
by: phong.lee | last post by:
Is there a reason why i keep getting this run time error, i never gotten it before. Can someone help me out with this? here is my code: With rstout 'first check if not on EOF If Not...
4
by: Chua Wen Ching | last post by:
Thanks Derek... Okay i had another question.. my program runs smoothly for the first minute, after 1 minute... suddenly it breaks and display this error: do you know what is the cause of...
1
by: Maashoff | last post by:
Hi, Im trying to run an excel macro that consolidates data on multiple tabs onto a singe tab. (ie. create a database). I am consolidating a total of 82 tabs into one. The macro works fine until it...
5
by: creative1 | last post by:
Hi all. I got a problem in my .exe version of the software. I created package wizard. For one command button, it displays messge "Cancel transaction". When I click OK, program crashes and displays...
7
by: LucasLondon | last post by:
Hi, I have the code below that I adapted to loop through each column of data (Columns A to GR) to perform an a calculation based on the data in rows 2 to 31 of each column and place the...
1
by: amolbehl | last post by:
Dim tempLeft As Long Dim tempWidth as integer tempLeft = Round(((tempWidth - i) * 100) / 18.39, 1) Hi, When I try to run this code and when tempWidth = 343, I get Runtime error 6...
0
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.