Manipulating field values in a form record

  • Thread starter Thread starter David T. Allison
  • Start date Start date
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
 
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."
 
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....
 
Back
Top