Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 November 25th, 2015, 08:13 PM
Registered User
 
Join Date: Nov 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting 2 txt boxes to a double number

I am trying to read 2 txt boxes from a form and convert the data to a number (example "5" in first txt box and "Giga" in second txt box to return "5000000000") and update a table with this number. I am a novice with access 2010.

txt box 1 is called Pre1
txt box 2 is called Pre1Unit
Field in table is called PreValue

Any help on this is very much appreciated.
Thank you.
 
Old November 29th, 2015, 08:44 AM
Authorized User
 
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
Default 1 textbox and 1 combobox to a double number

Hi,

If you haven't managed to sort this yet, here's one solution.

I'd use a combobox for pre1unit with 2 columns, set a value list 1000000, "Mega", 1000000000, "Giga" etc. Hide the first column by setting its size to 0cm in Columns Widths. Set Limit to List to Yes.

Set the AfterUpdate events of the textbox and combobox to calculate the prevalue:

Code:
Private Sub UpdatePreValue()
    Me.TextPreValue.Value = Me.TextPre1.Value * Nz(Me.ComboPre1Unit.Value, 0)
End Sub
I hope that helps you out.

Malc.
 
Old November 30th, 2015, 03:56 PM
Registered User
 
Join Date: Nov 2015
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank you

I knew there was a simple way to fix it that I just didn't know. Thank you for your help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
find number of lines in .txt file dgr7 Beginning VB 6 8 July 16th, 2014 05:11 AM
How to separate double number draganp71 Visual Basic 2008 Essentials 2 April 27th, 2010 04:11 AM
converting double to text in editbox rupali_mb Visual C++ 1 February 11th, 2007 12:14 PM
Converting number to hh:mm dlyles Beginning VB 6 8 September 19th, 2006 12:27 PM
Converting a string to a number steve456 Javascript How-To 2 November 17th, 2003 06:01 PM





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