Input numeric data in field (1 Viewer)

Monoceros

Registered User.
Local time
Today, 05:07
Joined
Oct 30, 2006
Messages
27
Hello,

Is there a way to create a field in a form which functions like a cell in Excel ?

I have a numeric field where I would like the result of an addition, so I would like to type e.g.
=10+15+4
and the result (29) would be the value of the field, but in the form I would like to be able to see the "=10+15+4".

Thank you,
 
Local time
Yesterday, 23:07
Joined
Mar 4, 2008
Messages
3,856
Access is quite a bit different than Excel and has a different purpose. Excel is an excellent number cruncher and reporting tool. Access is a good data management tool...and forget WYSIWYG in Access. Calculations are part of everyday routine but runtime flexibility is lost.

I assume you want to do the calculation on the fly at runtime, somewhat like using a calculator?

You could build calculator type functionality using one or many unbound fields. It could take some moderately complex coding and thus, coding ability. I'd be tempted to just open a calculator and use that.

In general, with a text box you can do something like this during design time:
"=[Field1] + [Field2]"

The text box will keep track of the sum of the two text boxes named Field1 and Field2 at runtime (not at design time).
 

Monoceros

Registered User.
Local time
Today, 05:07
Joined
Oct 30, 2006
Messages
27
Yes, I know that it is quite different :)

The problem : it is a field which must be updated by addition several times a month and it would be best that the user could see al the historic values added to that field.

I can solve it by designing the table otherwise,but I was hoping someone knew a trick or so.
 

missinglinq

AWF VIP
Local time
Today, 00:07
Joined
Jun 20, 2003
Messages
6,423
You can do this, but in order for the

=10+15+4

to appear every time you goto the particular record, you'll have to have a separate field for it in your table. You can always re-calculate =10+15+4 so you get 29, but you can't do the reverse. 29 could be =10 + 15 + 4, or it could be =10 + 10 +9 , or =20 + 4 + 5.

So, say that the field to display is named Equation and the field to hold the calculation is named Total. In Design View, set the Visible Property of Total to No. Then use this bit of code:

Code:
Private Sub Equation_AfterUpdate()
 Me.Total = Eval(Mid(Me.Equation, 2, Len(Me.Equation) - 1))
End Sub
 

Users who are viewing this thread

Top Bottom