Help! Please

K

Kasey

I am working on a DB that has Inventory of spare parts.
one field is "Qty on Hand" and one is "Qty Used". How
do I get "Qty on Hand" to change when I enter a qty
in "Qty Used" and then reset "qty Used" back to Zero? Any
help would be very much appreciated. This is a project for
work and I am under pressure to complete it...I am not as
good at this as my boss thinks I am.
I am very new at this so please don't make it too
technical. Also I am a dummy when it comes to visual
basics. please help.
DO i DO THIS IN A QUERY OR THE FORM???
 
R

Rick B

Well, I would not put "qty used" in my table. That is a temporary field.
It should be an unbound field on the form your users will use for making
entries.

You will need to put code on your form in the 'after update' event of the
'QTY USED' unbound field. This will cause the math to happen as soon as
your cursor leaves the 'QtyUsed' field. You may decide it would be better
to do this as you move to the next recor. In either case, the code should
do the math, then clear the field. The code should say...


Private Sub QtyUsed_AfterUpdate()

QtyOnHand = QtyOnHand - QtyUsed

' Clear FIND Qty Used box
Me!QtyUsed.Value = ""

End Sub




Note: You should not use spaces in your field names.

Rick B



I am working on a DB that has Inventory of spare parts.
one field is "Qty on Hand" and one is "Qty Used". How
do I get "Qty on Hand" to change when I enter a qty
in "Qty Used" and then reset "qty Used" back to Zero? Any
help would be very much appreciated. This is a project for
work and I am under pressure to complete it...I am not as
good at this as my boss thinks I am.
I am very new at this so please don't make it too
technical. Also I am a dummy when it comes to visual
basics. please help.
DO i DO THIS IN A QUERY OR THE FORM???
 
K

Kasey

Thanks so very much Rick...that makes sense to me. I will
give it a try. Again thanks for your timely response.
Kasey
 
G

Guest

Thanks so much Rick...your suggestion worked like a charm.
You are my Hero!!!!
Kasey
 

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