Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Data Type in Access Backend database

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
0
0
US
I changed some fields in the back-end Access database (2000) from Currency data type to Decimal (18,2), and then I got an error "Type Mismatch," at the line of the code

if a=-99 then

Variable a is the calculation result from some variables taking value from Decimal fields.

If I change the code to

if cint(a)=-99 then

There is no error. But I would rather change field types back to Currency.

I know Decimal Data Type has some problem in Access, from Microsoft's Knowledge Base article 837148

Is this an Access database problem or VBScript problem?

Seaport
 
I'm not entirely sure I understand what your error is but a, as you initially have it written, is being read as a string variable. You will need to convert it to a numeric value, whether it be an integer (as you did later) or a currency (using CCur, I believe). But this is just the representation on the front end. If you're putting it back into the database, then just convert it when you do your INSERT statement.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top