Solved

VBA code help for multiplying values

Posted on 2011-02-17
6
883 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 119

Accepted Solution

by:
Rey Obrero 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 119

Expert Comment

by:Rey Obrero
ID: 34915523
no need to use two textboxes, one will do.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 119

Expert Comment

by:Rey Obrero
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now