Manipulating field values in a form record

D

David T. Allison

Hello,
As a user enters certain values into fields in my data entry form I would
like to give the user the option of clicking on a command button that
triggers a calculation that would then fill in several other fields in the
same form record. It seems to me that I would need to write a VB procedure
to do this, so what I would need would be code examples of how form fields
are accessed and assigned values in a VB procedure. I can handle the rest of
the VB coding once I know how to do that,

Regards,
David Allison
 
A

Al Campagna

David,
A few examples would have been helpful, but... as a general rule...
it's not advisable to "save" a calculated value to a table, but just
"display" the
result on any form, query, or report.
For example, if the user entered a Price and a Qty, an unbound calculated
field (LineTotal) with a ControlSource of...
= Price * Qty
would always "display" the LineTotal... even if Price or Qty might change
in the future.

Given that you've captured the Price and the Qty, you don't need to
capture the
LineTotal. Just recalcualte it "on the fly" in any subsequent form, query,
or report.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."
 
A

Albert D. Kallal

You can access a control on form as follows:


me.MyFieldName = "hello"

or

me.MyFieldName = me.MyOtherFieldName

You actually leave out the me., and simply use the name of the control,

eg:

MyFieldName = "hello"

However, most of us use the "me." keyword because it gives us a dropdown
(inteli-sense) list.

If your programmatic changing the reocrdsource of the form, and there is NOT
control placed on the form, then you should use

me!MyFieldName

the above syntax will allow you to reference the underlying field even if it
is not placed on the form as a control....
 
D

David T. Allison

Albert,
Thanks, your directions worked great in the form,

Regards,
David
 

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