Please help me...word vba and database

J

Jennifer

Dear Experts,

I really stack with this very small project....I have a word document and
its form from VBA...in the form there are one combobox called "Item Code" and
two textfields called "Description" and "Qty"..and there is a button called
"OK"...the scenario is, if I select "Item Code" it will show data on the
"Description" textfield and "Qty" let it blank (which is I already found it
about the codes) ...

My question is what codes if I fill the Qty textfield with 2 (the number
integer).. and then when I press "OK"..then it will deduct 2 as well in the
Item table on Access file please???...

I would very happy if you provide me a walktrough/codes for this....

Thank you very much for your helps..

Jennifer
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmVubmlmZXI=?=,
I really stack with this very small project....I have a word document and
its form from VBA...in the form there are one combobox called "Item Code" and
two textfields called "Description" and "Qty"..and there is a button called
"OK"...the scenario is, if I select "Item Code" it will show data on the
"Description" textfield and "Qty" let it blank (which is I already found it
about the codes) ...

My question is what codes if I fill the Qty textfield with 2 (the number
integer).. and then when I press "OK"..then it will deduct 2 as well in the
Item table on Access file please???...

I would very happy if you provide me a walktrough/codes for this....
This is really a question you should ask in an Access newsgroup. Basically,
though, you'd have two approaches.

1. Use DAO or ADO (whichever you're using to pull the data from the database
into the form). Set up a recordset containing just the selected record from
"Item Code". Set the value for the "QTY" field. Very roughly
intQty = rs.Fields("Qty").Value
intQty = intQty - txtQty.Value
rs.Fields("Qty").Value = intQty

2. Faster, but perhaps more complex for you to deal with, would be to run an
UPDATE query on the recordset.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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