473,387 Members | 3,801 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.

"Object no longer valid" Error Message

I am pretty new to all of this and am working on a macro to transfer some data. I am using "Select Case" and when it reaches .Paramater.Append prm(i) is throws the "Invalid Object error". I don't even know where to start trouble shooting this? I'm a novice and need some help. Thanks!

Expand|Select|Wrap|Line Numbers
  1. If Len(sSQL) > 0 Then
  2.         Set cmd = New ADODB.Command
  3.         With cmd
  4.             .ActiveConnection = con
  5.             .CommandText = sSQL
  6.             .CommandType = adCmdStoredProc
  7.             For i = 0 To 39
  8.                 If aryData(i) = "" Then aryData(i) = Null
  9.                  Select Case i
  10.                         Case 0 To 2
  11.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adInteger, adParamInput, , aryData(i))
  12.                         Case 3 To 14
  13.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adCurrency, adParamInput, , aryData(i))
  14.                         Case 15 To 23
  15.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adDecimal, adParamInput, , aryData(i))
  16.                                prm(i).Precision = 18
  17.                                prm(i).NumericScale = 4
  18.                         Case 24 To 33
  19.                               Set prm(1) = .CreateParameter("@" & aryNames(i), adBoolean, adParamInput, 0, aryData(i))
  20.                         Case 34 To 34
  21.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adVarChar, adParamInput, 100, aryData(i))
  22.                         Case 35 To 38
  23.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adDecimal, adParamInput, , aryData(i))
  24.                                prm(i).Precision = 18
  25.                                prm(i).NumericScale = 4
  26.                         Case 39 To 39
  27.                               Set prm(i) = .CreateParameter("@" & aryNames(i), adCurrency, adParamInput, , aryData(i))
  28.  
  29.                  End Select
  30.  
  31.                  'OBJECT IS NO LONGER VALID ERROR???
  32.  
  33.                 .Parameters.Append prm(i)
  34.  
  35.  
  36.             Next
  37.  
  38.             .Execute
  39.         End With
  40.         Set cmd = Nothing
  41.     End If
  42.  
Oct 7 '10 #1
1 1827
Frinavale
9,735 Expert Mod 8TB
What is prm?
I don't see it defined in the code that you have posted.
Oct 7 '10 #2

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

Similar topics

2
by: David | last post by:
My email application was working a couple of weeks ago, then all of a sudden I get Error Type: (0x8009000F) Object already exists. I checked the permissions on the machinekeys directory...
1
by: Uttam | last post by:
Hello, How does one suppress the "Object already exists" message when the following statement is executed in ADO? cat.Views.Append "Some_Query", cmd Thanks in advance. Uttam
3
by: Nak | last post by:
Hi there, I am trying to make a collection that will work in the "Object collection editor" dialog. I have implimeneted ICollection, IList and IEnumerable and now I have an "unnamed"...
4
by: Mike Cooper | last post by:
There is something about inherited classes I evidently don't know... I wrote the following class: Class Class1 inherits System.Windows.Forms.DataGridTextBoxColumn End Class There is...
2
by: =?Utf-8?B?R2FicmllbCBNw6luZGV6?= | last post by:
Hello everyone. I have a small class that encapsulates some functionallity to work with the RSACryptoServiceProvider. Here is the code of the class i'm using: public class dsRSA { private...
2
by: boliches | last post by:
I have a form within my database which On Open (event procedure) will make many calculations and enter the results in text boxes on the page of the form (I have 2 tabs on this particular form). My...
6
Tarantulus
by: Tarantulus | last post by:
if("dept"=='dept'){ document.getElementById('add').style.display='none'; }; <DIV id="add"> <some html here..> </DIV>
8
by: webgenius | last post by:
Whenever I click the SUBMIT button in my HTML page, I get the "Object not found!" error. It was working fine yesterday. This error started to occur after I installed Codelobster and made some changes...
1
tlhintoq
by: tlhintoq | last post by:
I'm pretty sure this is language independent and is going to be the same whether it's VC or C# - but my project is C# WIndows Forms just in case. Does anyone have a good handle on the sequence of...
1
by: peachdot | last post by:
Just wondering..what should i do if this error came out?
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.