473,395 Members | 1,574 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,395 software developers and data experts.

ERROR: "Object Required" when trying to add parameter to ado command

hi all,

i get a run-time error '424': Object Required on the last line below, and i can't figure out why...

Expand|Select|Wrap|Line Numbers
  1.     Dim adoConn As New ADODB.Connection
  2.     Dim adoCmd As New ADODB.Command
  3.     Dim adoRecSet As New ADODB.Recordset
  4.  
  5. '    "SELECT dbDescription,dbExternal FROM EuroPrice WHERE dbFAB = '" & Format(txtFAB.Text, "@@@ @@@ @@@@") & "'"
  6.  
  7.     adoConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\qtomlyc\My Documents\PriceList.mdb" & ";User ID=Admin;Password=;"
  8.     adoConn.Open
  9.  
  10.     adoCmd.CommandText = "spGetEuro"
  11.     adoCmd.CommandType = adCmdStoredProc
  12.  
  13.     Dim adoParam As New ADODB.Parameter
  14.     adoParam.Name = "@FAB"
  15.     adoParam.Type = adVarChar
  16.     adoParam.Value = Format(Replace(txtFAB.Text, " ", ""), "@@@ @@@ @@@@")
  17.  
  18.     adoCmd.Parameters.Append (adoParam)
i got the idea to the adoCmd.Parameters.Append (adoParam) command from asp.net, where i would have used .Parameters.Add (adoParam), and figured append would be the same as add here. is it not?
Sep 24 '07 #1
6 6491
hariharanmca
1,977 1GB
Usualy this error will come if the object is not there

debug which line you are getting this error and check for that object.
Sep 24 '07 #2
Usualy this error will come if the object is not there

debug which line you are getting this error and check for that object.
as i said, i get the error on the last line, which is line 18. since i have used both adoCmd and adoParam before, i find it strange that any of them would not be there... but what is the easiest way to "check for an object"?
Sep 24 '07 #3
hariharanmca
1,977 1GB
Where you are declaring adoParam

Expand|Select|Wrap|Line Numbers
  1. adoCmd.Parameters.Append (adoParam)
I see it's there then check for regi

Okay try like this.

Expand|Select|Wrap|Line Numbers
  1. adoCmd.Parameters.Append adoParam
Sep 24 '07 #4
Where you are declaring adoParam

Expand|Select|Wrap|Line Numbers
  1. adoCmd.Parameters.Append (adoParam)
I see it's there then check for some other object.
i have now checked for both adoCmd and adoParam by inserting
Expand|Select|Wrap|Line Numbers
  1. MsgBox adoParam.Name
  2. MsgBox adoCmd.CommandText
  3. Exit Sub
on which both dialog boxes showed up. their messages were "@FAB" and "{ call spGetEuro }" respectively. What other objects could be needed for this line to work?
Sep 24 '07 #5
hariharanmca
1,977 1GB
Okay try like this.
Expand|Select|Wrap|Line Numbers
  1. adoCmd.Parameters.Append adoParam
  2.  
Sep 24 '07 #6
QVeen72
1,445 Expert 1GB
hi all,

i get a run-time error '424': Object Required on the last line below, and i can't figure out why...

Expand|Select|Wrap|Line Numbers
  1.     Dim adoConn As New ADODB.Connection
  2.     Dim adoCmd As New ADODB.Command
  3.     Dim adoRecSet As New ADODB.Recordset
  4.  
  5. '    "SELECT dbDescription,dbExternal FROM EuroPrice WHERE dbFAB = '" & Format(txtFAB.Text, "@@@ @@@ @@@@") & "'"
  6.  
  7.     adoConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\qtomlyc\My Documents\PriceList.mdb" & ";User ID=Admin;Password=;"
  8.     adoConn.Open
  9.  
  10.     adoCmd.CommandText = "spGetEuro"
  11.     adoCmd.CommandType = adCmdStoredProc
  12.  
  13.     Dim adoParam As New ADODB.Parameter
  14.     adoParam.Name = "@FAB"
  15.     adoParam.Type = adVarChar
  16.     adoParam.Value = Format(Replace(txtFAB.Text, " ", ""), "@@@ @@@ @@@@")
  17.  
  18.     adoCmd.Parameters.Append (adoParam)
i got the idea to the adoCmd.Parameters.Append (adoParam) command from asp.net, where i would have used .Parameters.Add (adoParam), and figured append would be the same as add here. is it not?
Hi,

use "Set" keyword to set Text of Command Object :

Expand|Select|Wrap|Line Numbers
  1. Set adoCmd.CommandText = "spGetEuro"
  2.  
U have to use "CreateParameter" of command object

Expand|Select|Wrap|Line Numbers
  1. Dim adoParam As New ADODB.Parameter
  2. Set adoParam = adoCmd.CreateParameter
  3.  adoParam.Name = "FAB"
  4.  adoParam.Type = adVarChar
  5.  adoParam.Value = Format(Replace(txtFAB.Text, " ", ""), "@@@ @@@ @@@@")
  6.  
  7.   adoCmd.Parameters.Append (adoParam)
  8.  
Regards
Veena
Sep 24 '07 #7

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

Similar topics

2
by: Dave Hammond | last post by:
I've got what should be a simple assignment of either an element value or a default string to a variable, but when the element doesn't exist I get an "Object required" error rather than an...
2
by: chacquard | last post by:
Hi, I've been working on a form that contains a subform. The fields in the main form are EvendId, EventName, Date, time, place, etc.. These fields cannot be edited (locked = yes and...
5
by: Brent | last post by:
This AJAX stuff is all new to me. To try it out, I borrowed this code from a website: ======================== var http_request = false; function makeRequest(url) { http_request = false;
5
by: DaFallus | last post by:
I'm trying to write a somewhat simple page with dependent drop-down boxes. Unfortunately the entire page is written through PL/SQL so that makes it even more difficult for me to trouble shoot. I...
4
by: Phil | last post by:
Hi, This code gives an javascript error: "Object required" and never let see the Alert window. in code-behind: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As...
6
by: Anette | last post by:
Hi, When I load pages through the db, e.g.: ovrigt.php?typ=disco and after that go to the menu I get an error message from IE6: "Object required" (translated from swedish IE). Part of menu: <div...
1
by: Nilam2477 | last post by:
I'm invoking COM dll method from VB program. COM interface method takes one of the parameter as IUnknown as below HRESULT SetMethod( long samNumber, IUnknown* List); When i try to call this...
11
by: dougmeece | last post by:
Good Morning Experts, I spent all weekend working on this and got absolutely no where. I have a database with an input form that runs an append query to append to a table. Form Name: ...
10
by: andersond | last post by:
On a webpage that has a variety of questions I get an "object required" error on lines like this... document.getElementById('tableQuestion17').style.visibility="visible"; This is the code...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.