Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2003, 12:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default Text Box Calculations

If one types the following in a cell in Excel

=7+4

the result 11 is stored in the cell.

Is it possible to get an Access textbox to emulate this functionality. I'm sure I've read about doing it in the past but just can't remember where. Many thanks.

Clive Astley
__________________
Clive Astley
 
Old August 15th, 2003, 01:03 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There isn't for a cell in a table in the same manner, but in the AfterUpdate event for a cell you call the Eval function.

Example: In a textbox, I enter 11/4 and if I have an after update event on the form to convert to a decimal such as

TxtNum = Replace(TxtNum, " ", "+")
TxtNum = Eval(TxtNum)

The result would be 2.75

There would be additional code to trap any errors and make sure the value is numeric, but read up on the Eval function in online help.

HTH,

Beth
 
Old August 15th, 2003, 11:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many thanks Beth

Clive Astley





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM
Rich Text Box vs Text Box snowy0 VB.NET 2002/2003 Basics 1 February 17th, 2004 02:11 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.