473,398 Members | 2,812 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,398 software developers and data experts.

RecordSet error? Object Required

Oli
Hi

Hope someone can help:

<%
set rsProdInfo = Server.CreateObject("ADODB.Recordset")
rsProdInfo.Open "TBL_Products", Conn

intTotal = 0

rsProd.MoveFirst
'while not rsProd.EOF
rsProdInfo.MoveFirst
' rsProdInfo.Find "ProdID = " & rsProd("ProdID")
intProdID = rsProd("ProdID")
strProdName = rsProdInfo("Product")
intPrice = formatNumber(rsProdInfo("Price"), 2)
'intQuant = rsProd("quantity")
'intExtPrice = formatNumber((intPrice * intQuant), 2)
intTotal = intTotal + intPrice
%>

ERROR:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/shop/checkout.asp, line 103

-----------------
Line 103: rsProd.MoveFirst

------------
This is driving me insane now - all help is much appreciated!

Oli
Jul 19 '05 #1
4 6064
Oli wrote:
Hi

Hope someone can help:
ERROR:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/shop/checkout.asp, line 103

-----------------
Line 103: rsProd.MoveFirst

------------
This is driving me insane now - all help is much appreciated!

Oli


If you put "Option Explicit" at the beginning of your script block, you will
avoid these errors.

You have :

rsProdInfo.Open "TBL_Products", Conn

followed by:

rsProd.MoveFirst

See the problem?

Incidently, you are using an expensive, inefficient method to do this task.
Follow up in a new thread, providing a few more details about what you are
doing, if you are interested in hearing about a better way.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
Oli
Hi Bob

Thanks for the reply. Such basic stuff - im stupid. Anyway now I have an
issue with...

intPrice = formatNumber(rsProd("Price"), 2)

ERROR:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'formatNumber'
/shop/checkout.asp, line 109

Any ideas?
THanks
Oli

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
Oli wrote:
Hi

Hope someone can help:

ERROR:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/shop/checkout.asp, line 103

-----------------
Line 103: rsProd.MoveFirst

------------
This is driving me insane now - all help is much appreciated!

Oli


If you put "Option Explicit" at the beginning of your script block, you

will avoid these errors.

You have :

rsProdInfo.Open "TBL_Products", Conn

followed by:

rsProd.MoveFirst

See the problem?

Incidently, you are using an expensive, inefficient method to do this task. Follow up in a new thread, providing a few more details about what you are
doing, if you are interested in hearing about a better way.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #3
Oli wrote:
Hi Bob

Thanks for the reply. Such basic stuff - im stupid. Anyway now I
have an issue with...

intPrice = formatNumber(rsProd("Price"), 2)

ERROR:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'formatNumber'
/shop/checkout.asp, line 109


Well, it still says "rsProd" .... Did you change "rsProdInfo" to "rsProd"?

If you are using the correc recordset variable, then the Price field could
contain a Null, which cannot be handled by formtNumber. I suggest modifying
your query to guarantee that the value in Price will never be a Null. If you
can't do that, I wrote a little function for my script library:

function NullToZero(pData)
if len(pData) = 0 then
NullToZero = cdbl(0)
else
on error resume next
pData = cdbl(pData)
if not IsNumeric(pData) then pData = 0
NullToZero = cdbl(pData)
end if
end function
Use it like this:

intPrice = formatNumber(NullToZero(rsProd("Price")), 2)

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #4
Does Price allow NULLs? If so, stop doing that.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

intPrice = formatNumber(rsProd("Price"), 2)

ERROR:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'formatNumber'

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
4
by: dubing | last post by:
Hi, Our webpage uses the following JavaScript code. function toggleSubmenu(divId, link) { var div = document.getElementById(divId); div.style.display = (div.style.display == 'block') ?...
1
by: Andrew Phillipo | last post by:
I have some code that works everywhere but IE5.0, including IE5.5. Here is a snippet of where the code seems to go wrong: Location.prototype.change = function(current) { this.current = current;...
3
by: maartha | last post by:
i have a js code which displays two html div on a click event.code is like this. function display() { document.getElementById('headingtd1').bgColor="#EFEBEF"; ...
3
by: rathiagu | last post by:
the below is my part of set cn = Server.CreateObject("ADODB.Connection") strCS = "Provider=System.Data.SqlClient; Data Source=" & _ Server.MapPath("management.mdb")& ";" cn.open strCS
2
by: Vbbeginner07 | last post by:
Please check the following code for adding records to a database: Im getting the error:object required in the following code( which is in bold letters) kindly go through Private Sub...
3
by: ShyamKrishnegowda | last post by:
We are writing test scripts to our product. In one of the script we are facing an issue. This test script will create a COM component and executes the following function. O1 and O2 are out...
1
by: ShyamKrishnegowda | last post by:
We are writing test scripts to our product. In one of the script we are facing an issue. This test script will create a COM component and executes the following function. O1 and O2 are out...
1
by: freefony | last post by:
i built a shopping software for a customer its working perfectly on my system but when i transferred to my customer's old desktop system this script throws error "object required" i tried Flock...
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: 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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.