Enter a Formula in a Numeric Text Box?

evanscamman

Registered User.
Local time
Yesterday, 17:20
Joined
Feb 25, 2007
Messages
274
Is there any way for a user to be able to type a formula into a numeric field?

I want to type: "9/16" or "=9/16" into a numeric text box and have it instantly converted into decimal equivalent. ("0.5625")

The control is bound to a numeric field, and Access doesn't allow non-numeric symbols. I can't find any way to allow VBA to take the user entry and solve to numeric format before the data police strike.

Any ideas?

Thank you,
Evan
 
Is there any way for a user to be able to type a formula into a numeric field?

I want to type: "9/16" or "=9/16" into a numeric text box and have it instantly converted into decimal equivalent. ("0.5625")

The control is bound to a numeric field, and Access doesn't allow non-numeric symbols. I can't find any way to allow VBA to take the user entry and solve to numeric format before the data police strike.

Any ideas?

Thank you,
Evan

What you can do is to have a second UNBOUND text box sitting right in the same place as the bound one. Then, you could use the After Update event of the unbound text box on top to let you enter the fraction and then hit enter and then set the bound text box to the formula result and have it become visible and the other become invisible.

Just a suggestion. Then, if they needed to edit it, you could set it so that the double click event of the other text box would bring the unbound text box to be visible again.
 
Thanks, Bob.

I was afraid this would be the only way.

Since I am using a form with user defined fields - difficult enough to do, already - I don't think this is an option will work for me.

I wonder if Access 2007 allows this?
 
Nope, if you have a bound datatype, it has to be that type.
 
Ok, too bad.

I'm thinking about your 1st post though..
Because the number, placement and size of the numeric fields on my form is user-defined, it would be messy to have a duplicate unbound field for each.

But I could have a single 'formula' field, that a double-click from any numeric field will size and position to match, then make visible.

The more I think about this the better I like it.

Thank you!
Evan
 
You could then assign the results to the field that was double-clicked by using

Screen.PreviousControl = YourCalculationHere

Of course, all this just points out the inherent madness of allowing users to decide which fields appear on a form and which don't!

Good Luck!
 
Thanks, missinglinq.

I will try this. I know my project is ambitious, but I needed users to be able to create categories, and then define and setup fields for each category.

Thanks again,
Evan
 

Users who are viewing this thread

Back
Top Bottom