PDA

View Full Version : I really need your helps...word vba with database integration



geeky
01-09-2006, 01:14 AM
Dear Experts,

I really need your helps...I am creating an interactive invoice....

I really stack with this codes....I have a word document and
its form created with VBA words...in the form there are one combobox called "Item Code" and
five textfields called "Description", "Qty", "Unit Price" and "Total"....the scenario is, if I select "Item Code" it will show all data collected from access database and show into each textfields (except "Qty" textfield)
"Description" textfield and "Qty" (I let it blank for manual filling) (which is I already found it
about these codes and you should no worries about this) ...

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

Furthermore, I provide an attachement of file for your review...

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

Thank you very much for your helps..

Sammy :hi:

matthewspatrick
01-09-2006, 04:22 PM
Sammy,

Rather than trying to get Word to do the invoice and then update Access properly, it will take you a fraction of the time and the effort to just do the whole thing in Access.

Patrick

geeky
01-09-2006, 07:47 PM
Hi,

Thanks for the advice...However, I just would like to know codes for that in Words VBA...

Could you please help me for that..???

Thanks a lot...

Sammy:doh:

geeky
01-11-2006, 01:41 AM
Dear Experts,

I have tried many times..many ways...try to make it works...but, it is still stack...would you please help me..???

I have this codes:






Private Sub cmd_update_Click()


Dim current_qty, After As Integer

current_qty = Val(txtqty.Text)
After = rst.Fields("Qty")

With rst
After = rst.Fields("Qty").Value - current_qty
.Update
End With
End Sub




and I have tried to make this codes works but I received this error message:

Run Time Error 3251
Current Recordset does not support updating. This may be a limitation of the selected locktype.

and also the .Update was highlighted in yellow color....

Please help me for this...I have attached my files for your reviews....I will be happy if you add/adjust/repair codes for the missing one...

Thanks a lot..

matpen
01-26-2006, 03:53 PM
Hi geeky!
I am a bit late here but I would like to know if you got it or not yet?images/icons/icon5.gif
Matpen

geekgirlau
01-26-2006, 05:08 PM
I can't see in your code where rst is set - this is where your problem lies as the error message is telling you it is not updatable.

By the way, I agree with Patrick - much quicker to create this directly in Access.

matpen
01-27-2006, 02:54 AM
Hi geekgirlau (member.php?u=450) (how do you pronounce this nickname! It?s a twist for the mouth!:wot)

I agree with Patrick also, :yes and Sammy (geeky) also agrees with Patrick but the point is simply how it can be done (theory and practice) even if it is not the optimal way. I just found myself with nearly the same problem. And IT HAS TO BE DONE FROM WORD ONLY. (200% from Word only, one of those rare occasions!)

Matpen