Help, Please!!! (1 Viewer)

camaroltd82

Registered User.
Local time
Today, 12:20
Joined
May 10, 2002
Messages
30
I am new to access this year. I am finishing up an Access 97 db that I need one more feature out of.

3 Fields in my table are the following. Current, UnitCost, TotalValue.
(Current being the current number of an item in stock)

I have to be able to make the database autocalculate the Total Value, based on the Current * UnitCost function. I know this is simple in Excel, but I can't figure out how to make it work in Access. Can I do this in a datasheet view? Or does it only work in form view? PLEASE HELP!!!

Thanks,
Mike Fischer
 

Newman

Québécois
Local time
Today, 07:20
Joined
Aug 26, 2002
Messages
766
You could create a field, in your form or report, with the Source being:
[Current] * [UnitCost]
BUT, you should not put this field in tables. Never put calculated fields in tables.
Newman
 

Jack Cowley

Registered User.
Local time
Today, 12:20
Joined
Aug 7, 2000
Messages
2,639
In the forms On Current event this code should work:

Me.TotalValue = Me.Current * Me.UnitCost

The TotalValue control on the form should be an unbound control as you do not want to save the calculation in your table.

hth,
Jack
 

camaroltd82

Registered User.
Local time
Today, 12:20
Joined
May 10, 2002
Messages
30
But..

I still have a problem, I am trying to get the changes that my calculation made in form view to be reflected in the actual table. How come this is not working?

Mike

Thanks again
 

Jack Cowley

Registered User.
Local time
Today, 12:20
Joined
Aug 7, 2000
Messages
2,639
I am not sure what you mean, but you do not want to save the TotalValue in the table. Calculate it as you need it...

Jack
 

camaroltd82

Registered User.
Local time
Today, 12:20
Joined
May 10, 2002
Messages
30
Is that really what I want to do?

This may help... This particular part of my program is being used for an annual inventory. My user needs to be able to enter in correct numbers of products whenever they are finished counting them. I dont want them to have to put in 3000 new quantities, and then re-multiply all 3000 new quantities by the unit cost to get the new total value, it seems that the program should be able to do this on the fly.

Mike
 

Jack Cowley

Registered User.
Local time
Today, 12:20
Joined
Aug 7, 2000
Messages
2,639
You don't have to remultiply. If the code is in the On Current event then whenever they look at a specific record they will see the correct value.

Below is an article that you should read if you are creating an Inventory Control program....

Inventory Control


Jack
 

Users who are viewing this thread

Top Bottom