Project saves Access DB with Invalid Data Types

G

glenn

Hi,

I save a MS Project as a MS Access database. If I open the database in MS
Access and I look at the Task Table (MSP_TASKS), I see that the Cost field
has a Number data-type and the Duration field also has a Number data type.
The Cost field should have a Currency data type.

In my ASP code, I can check between dates and numbers by simply asking,

if IsNumeric (value) then .... the value is a number otherwise it is a
date.

But if the value is a cost which in this case has a number data type, then
it should have a currency data type and not a number type. Since my code has
no way of knowing if my data is a number, as in a duration, or a cost (which
should be set as currency), my ASP code sets all numeric data to currency
which is wrong if the data is a duration or any other non-currency number.

Do I need to write an Access VBA app that changes all cost related fields to
currency? Is there a way for me to check if the value comes from a cost
field in my recordset. This could be messy...

Thanks for any tips.
Glenn
 
R

Rod Gill

Projects tend to get updated once a week (if you're lucky!!) so maybe a VBA
macro and Queries that copies data you need to a temporary table with field
types you want?

Changing any Project created field is dangerous and can lead to lost or
corrupted data.
 
G

glenn

Rod,

I knew there had to be something in VBScript to determine data types and
there is. It's the function vartype (var)

This tells you if you have a number or currency. I am going into the Access
database and changing my cost fields, (i.e. Cost, ACWP, BCWP, BCWS, etc.)
to a currency data type. Also, I have found that subsequent saves to my
Project file as an Access database do not change my currency data types
back to numbers which is what the initial save to a DB did.

Apparently IsNumeric (data) , does not distinguish between numbers and
currency, so I simply put an extra conditional in my if statement to check
if the vartype is currency or not.

Glenn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top