Solved

VBA code help for multiplying values

Posted on 2011-02-17
6
914 Views
Last Modified: 2012-05-11
Hello all,

I need help with two sets of code as I am undecided which option to go with yet.

First code - If I enter a value into text box "txt_cb_two_enter" then the text box "text_cb_two_result" displays the value from "txt_cb_two_enter" mutiplied by 500.  So 1 is entered in the first box and 500 is displayed in the second box.

Second code - If I enter a value into text box "txt_cb_two" then the value is mutiplied by 500 and the result is displayed in the same text box but as currency.  So 1 is entered in the box and £500 is displayed.

Thanks in advance.

Chris
0
Comment
Question by:smods
  • 3
  • 2
6 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 34915430
use the afterupdate event of  "txt_cb_two"

private sub txt_cb_two_afterupdate

me.txt_cb_two.value=me.txt_cb_two * 500

end sub
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 250 total points
ID: 34915471
Chris,

Try this one:

Private Sub txt_cb_two_enter_AfterUpdate()
Me.txt_cb_two_result = Me.txt_cb_two_enter.Value * 500
End Sub
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34915523
no need to use two textboxes, one will do.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:smods
ID: 34915552
Yeah thanks both for your input!

I haven't decided on my final approach for the job in hand yet capricorn1.  

My users may want to go with two boxes so they can see the initial value they have entered.  If I was to go with a single box approach what would the code be to change the field type to currency from a number?

Regards

Chris
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34915557
just set the format of the textbox to currency
0
 

Author Closing Comment

by:smods
ID: 34915817
I'm still not sure which I'll be going with but both work :)

Thanks

Chris
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question