Question on developing formulas

D

dprocket

I am very new to databases and so this is likely a dumb question. I have a
spreadsheet that I am trying to migrate to a DB. The problem is that I don't
know how to re-create the calculation that I have in my spreadsheet.

It's pretty simple stuff, I have a "gross", "expense" and a "revenue'
column. In my spreadsheet, I use a simple forumla to automatically populate
my "revenue" column (revenue = gross-expense).

I am setting up a web interface that will use the database as it's source.
I'm hoping to have my sales reps enter thier sales data into a asp-page and
have the "revenue" column calculated automatically instead of them entering
it manually. Does this make sense? I suspect I will need to build a
function or a query of some sort, but am struggling to find answers. thanks
in adavance for the help.
 
O

Ofer

You need to create a query that contain all the feilds +
the a revenue field that has the formula gross-expense.

"select *.MyTable, gross-expense as revenue from MyTable"

If I understood your question
 
J

John Vinson

I am very new to databases and so this is likely a dumb question. I have a
spreadsheet that I am trying to migrate to a DB. The problem is that I don't
know how to re-create the calculation that I have in my spreadsheet.

It's pretty simple stuff, I have a "gross", "expense" and a "revenue'
column. In my spreadsheet, I use a simple forumla to automatically populate
my "revenue" column (revenue = gross-expense).

I am setting up a web interface that will use the database as it's source.
I'm hoping to have my sales reps enter thier sales data into a asp-page and
have the "revenue" column calculated automatically instead of them entering
it manually. Does this make sense? I suspect I will need to build a
function or a query of some sort, but am struggling to find answers. thanks
in adavance for the help.

A Spreadsheet and a relational database ARE VERY DIFFERENT THINGS.

Though a Table may look like a spreadsheet, *it is not*. In
particular, you do not, cannot, and should not try to have formulas or
calculated fields in a table. That's not what tables are for!

Instead, just store "real" data - your gross and expense fields in
this case - in your Table; then use a Query to do the calculation, or
put a control on your ASP page which does the calculation. It is
neither necessary nor appropriate to store the calculated field in the
table, as it can be recalculated whenever necessary.

John W. Vinson[MVP]
 

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