Text Box Question ... Please can anyone help me?

G

Guest

I have a table <table1> w/ 3 fields titled "fieldA",fieldB", & "fieldC"

"fieldA" = 1
"fieldB" = 2
"fieldC" = (?)

I have 3 Text Box in my form.
In my form I have 3 TEXT BOX's. FIRST TEXT BOX is tied to "fieldA"
In my form I have SECOND TEXT BOX tied to "fieldB". & finally I have a
Unbound THIRD TEXT BOX.

I want to Mulitply "fieldA" + "fieldB" and have it NOT just populated the
THIRD TEXT BOX with the answer of three but I would like it to populate my
table field "fieldC" with the number as well. Can this be done?
 
G

Guest

Hi, Eburg. Of course it can be done!

But, why would you want to when it can be calculated at any time in a query
or report definition faster than you can look it up from disk, and when
storing it risks it being incorrect if the table is changed outside the
context of your form?

Sprinks
 
G

Guest

Hi Mr Sprinks! Thank you for you support,

yes I realize what your saying but I need to have for "record purposes"
irreguardless; I will have another equation which would later on "use" that
fields cell value. The table would never be ported so there would be no
probs' w/ contex change. I guess I should also correct my earlier statement
about the "multiply" I meant to say "add". :) ty Mr. Sprinks for the
prompt reply.
 
G

Guest

Hi, Eburg. I still don't think there's any reason to store it; you can
recreate it as you need it, but I'll get off my pulpit, and just answer your
question.

Have a control on your form, say, txtFieldC, that is bound to FieldC, i.e.,
its ControlSource is set to FieldC. Because changing the value of either
FieldA or FieldB would change the sum, in the AfterUpdate event of each,
place the following code. To handle cases where one of them might be Null,
use the Nz() function to convert a Null to zero:

Me![txtFieldC] = Nz(Me![txtFieldA]) + Nz(Me![txtFieldB])

Sprinks
 

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