MS Access 2003 - Form question about a control source of a text box

How can I write the control source into VBA instead of in the properties window

For example if I have a textbox that divides two amounts in other text boxes, then i put

=[textboxA]/[textboxB]

in the control source of the properties window. how do i accomplish this in vb so that I can trigger it by events?? i know it is not the same because I already tried that.

Answers


That depends on what exactly you want to do. If you want to put the current value of textboxA / textboxB into textboxC, use:

Me!textboxC.Value = Me!textboxA.Value / Me!textboxB.Value

On the other hand, if you want to set the control source property so that the value is updated automatically, use:

Me!textboxC.ControlSource = "=[textboxA]/[textboxB]"

(Code untested, I don't have Access available right now.)


Need Your Help

Regex to match all us phone number formats

c# regex visual-studio

First of all i would say i have seen many example here and googled but none found that matches all the condition i am looking for some match top 3 not below some inbetween.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.