Forum Home
Press F1
 
Thread ID: 18600 2002-04-28 11:06:00 Troubles with Access/ASP/Web Guest (0) Press F1
Post ID Timestamp Content User
46121 2002-04-28 11:06:00 Hi,

In the process of building my webpage using ASP I've struck difficulties when adding variables. If you don't know anything about ASP don't go away yet, as I think this may be to do with Microsoft Access or VBscript, or any number of other possibilities.

I've got a set of variables for the costs of components, and when adding them together like so:

TotalCost=SystemCost+PrinterCost+ScannerCost+WebCa meraCost+DigitalCameraCost

They give the error when loading the page:

Microsoft VBScript runtime error '800a01a8'

Object required: '[number: 0]'

/web/purchase2.asp, line 15


Each variable has been defined, and the values for each are all pulled off an Access Database via:

Set PrinterCost = Printer('ExtraCost')

Each one of these variables works fine when printed as:

Response.Write PrinterCost

In Access the field containing the values for each of these variables is in 'Number' format. If I change it to currency it gives the error:

Object required: '[currency: 0]'

/web/purchase2.asp, line 15

What's the deal here?

Thanks for your help,

Erin
Guest (0)
46122 2002-04-28 21:40:00 You can get some strange things happening with type conversions in VBScript since all variables are of type Variant.

Try wrapping a CInt() or CLng() round each variable you are adding together, (assuming the values are in number format in Access)

eg.
Total = CLng(var1) + CLng(var2) + .....

Cheers

Mike
Guest (0)
1