table entry from forms

  • Thread starter Thread starter Terryb
  • Start date Start date
T

Terryb

Guest
I want to make a calculation in a form and have it entered in a table field.
 
Add a text box that is bound to the field that you want to store the calculated value in. If the calculations are based on the user's entry in some other fields, you can use the After Update event of those entry fields to perform your calculation and assign the result to the bound text box. The syntax would look something like this...

me.[TextboxToStoreValue] = me.[TextValue1] + me.[TextValue2]

Hint: You would want to make sure that all the fields you are using in your calculation have a value before you perform the calculation or you might get an error.
 
Dear Terryb and DML

I need to be able to do this also, however, I could not get it to work as outlined above.
My expression builder modifies the above to a point where I get error messeges only! Can anybody tell me the correct way to solve this? Thank you in advance.

My email address is: musicmaker@aristotle.net
 
Musicmaker,

What error messages are you getting? You may have some properties set differently than I have assumed for the above example.
 
I need to do the same thing. How do you create a bound textbox. The only textbox that I know how to create says unbound.

I'm new at this!
 
I need to store number of days based on the difference of start and end dates.
 
For storing calculations when using forms, I have found that if you write your formula in VB code instead of using the expression builder, that it stores the calculations in YOUR Tables! Example:

NAME
OF
FIELDS (in your table)

1stAmt
2ndAmt
3rdAmt
TotAmt

Next, make a form.

Then, Go to design mode and right click properties. Go to event.
Go down to On Enter.

Click and go into the code builder (not the expression builder). As soon as it opens up, you will see that the builder has automatically put two lines in there for you. That is your first line and last line of code. You insert your formula into the center. The formula for the above is:

TotAmt = ([1stAmt] + [2ndAmt] + [3rdAmt])

Your code layout will look like this:


Private Sub (name of field)_Enter

TotAmt = ([1stAmt] + [2ndAmt] + [3rdAmt])

End Sub

Hope this solves your calculation problems, It solved mine.
 

Users who are viewing this thread

Back
Top Bottom