473,461 Members | 1,906 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

To ignore Run Time Error

I have made a form, in which following two Run Time Errors occured, which ultimately, after clicking Debug button, goes to coding of the form:

1) Runtime error 6 "Overflow", if no data exists.
2) Runtime error 2501 "The SendObject action was cancelled".

How can I ignore Runtime error. Is their any way to ignore such type of erros.

Shall be grateful if anyone help me in this regard.

Thanks in advance
Aug 27 '07 #1
2 2675
JConsulting
603 Expert 512MB
I have made a form, in which following two Run Time Errors occured, which ultimately, after clicking Debug button, goes to coding of the form:

1) Runtime error 6 "Overflow", if no data exists.
2) Runtime error 2501 "The SendObject action was cancelled".

How can I ignore Runtime error. Is their any way to ignore such type of erros.

Shall be grateful if anyone help me in this regard.

Thanks in advance
can you paste in your code...indicating the lines where this is happening? The solution definately isn't ignoring RunTime errors...it's correcting why they are happening. Let's do that in stead.

J
Aug 27 '07 #2
I have a Form in which following options are available to get the e-mail addresses of the respective records, based on the following code:

Status
Group
Item
Country
City

-------------------------------------------------------------------------------------------------------

Dim MyDatabase As Database
Dim MyQueryDef As QueryDef
Dim where As Variant

Set MyDatabase = CurrentDb()
If ObjectExists("Queries", "qryDynamic_QBF") = True Then
MyDatabase.QueryDefs.Delete "qryDynamic_QBF"
MyDatabase.QueryDefs.Refresh
End If

where = Null
where = where & " AND [Status]= '" + Me![DataBank Status] + "'"
where = where & " AND [Country]= '" + Me![DataBank Country] + "'"
where = where & " AND [City]= '" + Me![DataBank City] + "'"
where = where & " AND [Group]= '" + Me![DataBank Group] + "'"
where = where & " AND [Item]= '" + Me![DataBank Item] + "'"


If left(Me![DataBank City], 1) = "*" Or Right(Me![DataBank City], 1) = "*" Then
where = where & " AND [City] like '" + Me![DataBank City] + "'"
Else
where = where & " AND [City] = '" + Me![DataBank City] + "'"
End If


Set MyQueryDef = MyDatabase.CreateQueryDef("qryDynamic_QBF", _
"Select * from Find1 " & (" where " + Mid(where, 6) & ";"))

DoCmd.OpenForm "Email"
DoCmd.Close acForm, "frmDynamicQBF", acSaveNo
End Sub
----------------------------------------------------------------------------------------------------
& at the time of opening Form “Email”, which has following code, shows Runtime error in the following line of Form_Current.

iListItemsCount = iListItemsCount + 1

Form E Mail has created to retrieve the selected items in a multiple selection List Box as a comma-delimited string. For which, you may refer following link

http://support.microsoft.com/kb/827423

Now, you can understand what is the problem.

---------------------------------------------------------------------------------------------------
Private Sub Form_Current()
Dim oItem As Variant
Dim bFound As Boolean
Dim sTemp As String
Dim sValue As String
Dim sChar As String
Dim iCount As Integer
Dim iListItemsCount As Integer


sTemp = Nz(Me!mySelections.Value, " ")
iListItemsCount = 0
bFound = False
iCount = 0

Call clearListBox

For iCount = 1 To Len(sTemp) + 1
sChar = Mid(sTemp, iCount, 1)
If StrComp(sChar, "") = 0 Or iCount = Len(sTemp) + 1 Then
bFound = False
Do
If StrComp(Trim(Me!Nameslist.ItemData(iListItemsCount )), Trim(sValue)) = 0 Then
Me!Nameslist.Selected(iListItemsCount) = True
bFound = True
End If
iListItemsCount = iListItemsCount + 1

Loop Until bFound = True Or iListItemsCount = Me!Nameslist.ListCount
sValue = ""
Else
sValue = sValue & sChar
End If
Next iCount
End Sub

Private Sub clearListBox()
Dim iCount As Integer

For iCount = 0 To Me!Nameslist.ListCount
Me!Nameslist.Selected(iCount) = False
Next iCount
End Sub

Private Sub OK_Click()
Dim StText As String
Dim stDocName As String
stDocName = "Empty_Report"

StText = "We are interested in buying the following items for Shipment" & Chr$(13) & _
Chr(13) & "1." & Chr$(13) & _
Chr(13) & " a) Size of Briquets/Bales :" & Chr(13) & _
" b) Origin :" & Chr(13) & _
" c) How much Quantity you are going to load in 20'/40' container: " & Chr(13) & _
Chr(13) & "Awaiting your reply." & Chr$(13) & _
Chr(13) & "Thanks," & Chr$(13) & _
Chr(13) & "Manager - Purchase" & Chr$(13) & _
'DoCmd.SendObject acSendNoObject, stDocName, acFormatXLS, Me.mySelections, , , "Enquiry", StText, True

End Sub

Private Sub testmultiselect_Click()
Dim oItem As Variant
Dim sTemp As String
Dim iCount As Integer

iCount = 0

If Me!Nameslist.ItemsSelected.Count <> 0 Then
For Each oItem In Me!Nameslist.ItemsSelected
If iCount = 0 Then
sTemp = sTemp & Me!Nameslist.ItemData(oItem)
iCount = iCount + 1
Else
sTemp = sTemp & "" & Me!Nameslist.ItemData(oItem)
iCount = iCount + 1
End If
Next oItem
Else
MsgBox "Nothing was selected from the list", vbInformation
Exit Sub 'Nothing was selected
End If

Me!mySelections.Value = sTemp
End Sub
Private Sub clrList_Click()
Call clearListBox
Me!mySelections.Value = Null
End Sub

----------------------------------------------------------------------------------------------------------
Aug 29 '07 #3

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

Similar topics

6
by: Rob Meade | last post by:
Lo all, I was just running through some code I was writing for a site and when it came to the 'exact phrase' search type I wasn't sure whether that should run through and ignore the words in the...
1
by: Thomas Bartkus | last post by:
The meaning of REPLACE INTO is clear to me. IF the new record presents new key values, then it is inserted as a new record. IF the new record has key values that match a pre-existing record, then...
12
by: Gary | last post by:
Hi! guys, I have a SQL agent job fails because it gets 10 warnings when it runs a stored procedure. These warnings are trivial and can be ignored. Can I make it ignore these warnings and...
1
by: Greg | last post by:
The following code works fine on Mozilla but generates an error* on IE, when the button calling the function is pressed and the slideshow is either on the first slide or last slide. * I can't...
3
by: krose | last post by:
I have created an Installer using the "Setup Wizard" in Visual Studio. I've added a custom action to this as a seperate DLL written in C#. The custom action has to install files from another...
23
by: FrancisC | last post by:
#include <stdio.h> int file_copy( char *oldname, char *newname ); int main() { char source, destination; printf("\nEnter source file: ");
4
by: Jackson Miller | last post by:
I notice that postgres does not support IGNORE. I am currently migrating an app from a MySQL datastore to Postgres, and I would really like to use IGNORE. I am curious if there is a...
1
by: alw0015 | last post by:
I'm working on a piece of code that reads in a time from the user. This time value consists of 3 separate inputs: 1 integer representing hours 1 char representing the ":" 1 integer...
6
by: sandy | last post by:
I seem to ALWAYS need to use cin.ignore in my programs (console apps using Dev C++ for a University course). The problem is that if I don't ignore ENOUGH characters then it's like not having the...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.