Newbie: changing the value of a field on form (1 Viewer)

d9085

New member
Local time
Today, 07:35
Joined
Dec 11, 2005
Messages
5
Hello...

I am a newbie to Access or any database for that matter. So please be gentle.
I'm in the process of writing an automotive invoicing database and have gotten stuck early in the game.
On my form I have Qty1 - Mat1 - and Amt1 fields placed from my database.
In Amt1 I would like to typein an amount and have it multiplied by 15% (.015).
I fiddled with the "On Enter" in the Amt1 property box but got nowhere.
Can someone help???

Thanks for your time
d9085@hotmail.com
 

statsman

Active member
Local time
Today, 10:35
Joined
Aug 22, 2004
Messages
2,088
If you're running your form from a query, simply add a new field to your query. We'll call it ExtendedAmount. In the query go to a blank field and enter:
ExtendedAmount:Sum([Amt1]*.015)
Add the field ExtendedAmount to your form.
 

d9085

New member
Local time
Today, 07:35
Joined
Dec 11, 2005
Messages
5
This is a "fill-in" form. Connected directly to the corresponding database table.
There are no queries.
Any more suggestions?
 

Laurentech

Registered User.
Local time
Today, 08:35
Joined
Nov 7, 2005
Messages
107
In the afterupdate event of the amount control you could do:

Amt1=Amt1+(Amt1*.015)


Larry
 

d9085

New member
Local time
Today, 07:35
Joined
Dec 11, 2005
Messages
5
Thanks to all that tried to help.

Thanks also to Larry. Your suggestion worked best for my situation.
 

d9085

New member
Local time
Today, 07:35
Joined
Dec 11, 2005
Messages
5
OK More Problems

Not that I have used Larry's suggestion and thinking everythings peachy, reality bites my butt.
Adding the fomula to properties page works great. I did that for all 20 Amt's I had and each one works. I now have to total the column. I thought I could just use this formula for my "Total" field.
Total = Amt1 + Amt2 + Amt3 + ( all the way to Amt20)
It works but only if ALL 20 Amt's have been filled in. Remembering from my old DOS Paradox days I know there's NULL statement or possibly (ISBLANK) that can be made but heck if I know the syntex. Maybe I'm way off here....

Can anyone help????
 

ShaneMan

Registered User.
Local time
Today, 07:35
Joined
May 9, 2005
Messages
1,224
Hey d9085,

I'm not positive but I think Nz(Am1,0) + Nz(Amt2,0) etc etc, may work for you. I'm pretty sure Nz coverts null for you. In this case we're turning it to 0.

HTH,
Shane
 

d9085

New member
Local time
Today, 07:35
Joined
Dec 11, 2005
Messages
5
ShaneMan

Again I was fortunate enough to get some advice.
I used this:
Private Sub Total_Enter()
Total = IIf(IsNull(Amt1), 0, Amt1) + IIf(IsNull(Amt2), 0, Amt2) + IIf(IsNull(Amt3), 0, Amt3)
End Sub

I haven't tried your way yet. Also, would I enter it like below?????
Private Sub Total_Enter()
Total = Nz(Amt1,0) + Nz(Amt2,0)
End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom