Log in

View Full Version : Solved: Word FormText Calculation



rivvorz
07-13-2008, 11:09 AM
Hi,

I have a word document that serves as a menu for internal catering requests. The basic layout is as follows:

Column 1 = Descrptive text, i.e. the menu item
Column 2 = Unit Price ?0.00
Column 3 = Desired Quantity
Column 4 = Caclculation (Col3 x Col4)

My problem is that the Combobox has a limit of 25 items, however the upper limit for order quantities is 150, therefore I've had to use a Text Form Field (Numeric) for this input. Everything works as long as a number in input in the box, however if the box is left empty (i,e, Null) then the calculation forumla gives an error '!Unexpected End of Forumla'

Code for calculation:

{ = { FORM1_ITEM1_PRICE } * { FORM1_ITEM1_QU }}


Code for after_update: (which doesn't always fire)
Sub UpdateCosts()
ActiveDocument.Fields.Update
End Sub

Any help would be much appreciated - even if you can just point me in the right direction!

Thanks

/WordVBANooB!

lucas
07-13-2008, 12:29 PM
See if this thread gives you any leads. Read down through it before you give up.
http://www.vbaexpress.com/forum/showthread.php?t=9265&highlight=25+Form+limit

lucas
07-13-2008, 12:33 PM
Here's another one. You can search the forum at the top of the page.
http://www.vbaexpress.com/forum/showthread.php?t=8296&highlight=25+Form+limit

maybe you will find that the text form is not the best solution.

rivvorz
07-14-2008, 09:01 AM
Hello both,

Thanks for your replies. I've opted for sticking to the Text Fields to input the Quantity (even though I dislike this approach) and suppressing the error using macropod's nifty code.

Thanks for the replies - very much appreciated!