473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

displaying values in text boxes

266 256MB
this doesnt seem that difficult but i cant figure it out... i have a text box on my form that displays a number. i would like the form to automatically put half of that number in one text box and the other half in another text box... and update if i change that number... is this possible... thanks!
Feb 14 '09 #1
5 1406
missinglinq
3,532 Expert 2GB
The assignments will have to be done in the original textbox AfterUpdate event. But you're going to have to do a much better job of explaining what you mean by "half of that number in one text box and the other half in another text box!" What exactly composes each "half?"

Linq ;0)>
Feb 15 '09 #2
didacticone
266 256MB
Sorry for the generalization. I mean if I have a text box with the number 600 in it. I would like two other text boxes to display 300 each. If that's possible. Thanks for your help!
Feb 15 '09 #3
missinglinq
3,532 Expert 2GB
Where OriginalTextbox holds the original number:
Expand|Select|Wrap|Line Numbers
  1. Private Sub OriginalTextbox_AfterUpdate()
  2.  If Not IsNull(Me.OriginalTextbox) Then
  3.   Me.TextboxA = Me.OriginalTextbox / 2
  4.   Me.TextboxB = Me.OriginalTextbox / 2
  5.  Else
  6.   Me.TextboxA = Null
  7.   Me.TextboxB = Null
  8.  End If
  9. End Sub
If TextboxA and TextboxB are bound to a field in the underlying table, this is all you need. Simply replace the three textbox names with your actual names.

Having said that, calculated fields such as TextboxA and TextboxB should never really be stored in the underlying table! They should simply be re-calculated as needed. To do this as you move from record to record, in addition to the code listed above, you'll need the same code in the Form_Current event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Not IsNull(Me.OriginalTextbox) Then
  3.   Me.TextboxA = Me.OriginalTextbox / 2
  4.   Me.TextboxB = Me.OriginalTextbox / 2
  5.  Else
  6.   Me.TextboxA = Null
  7.   Me.TextboxB = Null
  8.  End If
  9. End Sub
If you need to use TextboxA and TextboxB in a report, create a calculated field on your report and use the same expressions as above.

Linq ;0)>
Feb 15 '09 #4
didacticone
266 256MB
ok the code you gave me works great... but i was wondering if its not a good idea to store the figures in an underlying table... what would be the proper coding to add up a few textboxes containing the results of the code you have just given me and some number that i will input myself and having them display in a totals textbox. i only have 1 record displaying information and i want it to update according to what numbers i put in. i hope im clear enough for you.. if you need more info please let me know... thanks for your help
Feb 15 '09 #5
NeoPa
32,556 Expert Mod 16PB
The code you're after would have to match the TextBoxes you need summed. This is only possible if you specify what you need more precisely, including all the names.
Feb 16 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Gertjan van Heijst | last post by:
Hi, I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store...
3
by: ChadDiesel | last post by:
I'm new to Access and need some advice. I am trying to setup a database to print labels and reports for our shipments. I have set up a table with fields such as I have taken a snapshot of what...
1
by: ChadDiesel | last post by:
I'm new to access and need some help. I have a form with a shipment destination at the top. I then have a subform that I enter boxes for that shipment. I have several shipments going at a...
3
by: duncan | last post by:
I have a text box on a web form here is the HTML for it :- <asp:textbox id="winPts" style="LEFT: 170px; POSITION: absolute; TOP: 80px" runat="server" Width="24px" maxlength="2"></asp:textbox> ...
2
by: JR | last post by:
I have tried searching boards but have not been able to find an answer. What is the best way to display text from a log.txt file and then display it in three seperate text boxes? I have a log...
5
by: Bill | last post by:
Hello, Could anyone post some simple code or advise me on how I can display the SSN number like *****7890 in a text box, even thought the user entered 1234567890, and the value of the variable...
2
by: moumita | last post by:
I have the folowing code..the logic according to me is correct..but I dont know...the msg boxes are not displaying anything...am I supposed to change any settings ??? Public Class Form1
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
4
by: kulali | last post by:
I have select option in html where the 3 text combo values are After, Between and Within.. So I need 2 display corresponding text boxes.ie 1) For after means a text box with image 2) For between...
1
by: mfaisalwarraich | last post by:
Hi Experts Around the World. Well im new to this paradise (Access). i have no experties in Access but i can still work with my mind :). i wish to request you people as under: I made a table...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.