I am trying to add integers in multiple textboxes and display them in a label just like VB. I am not having any luck. Can anyone help me get started?
Thanks
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Adding integers (2000)
Your code would look something like this:
Me.Label1.Caption = Nz(Me.Text1,0) + Nz(Me.Text2,0) + Nz(Me.Text3,0)
Where Label1 is assumed to be the name of the label and Text1, Text2 and Text3 are textboxes. The Nz functions are necessary because otherwise a Null in any of the textboxes will cause you problems.
Try putting the code in the After Update event of the text boxes, i.e.
– Select [Event Procedure] in the After Update box in the Properties window
– Click the … to the right of the dropdown arrow in the After Update box.
– Make the code look like this, with the appropriate names substituted:
Private Sub Text1_AfterUpdate()
Me.Label1.Caption = Nz(Me.Text1, 0) + Nz(Me.Text2, 0) + Nz(Me.Text3, 0)
End Sub
– Repeat for the other text boxes
– Remove the …_Exit event procedures.
If you still can’t make it work, you might post a stripped down copy of your database. See post 412737 for instructions.
Try putting the code in the After Update event of the text boxes, i.e.
– Select [Event Procedure] in the After Update box in the Properties window
– Click the … to the right of the dropdown arrow in the After Update box.
– Make the code look like this, with the appropriate names substituted:
Private Sub Text1_AfterUpdate()
Me.Label1.Caption = Nz(Me.Text1, 0) + Nz(Me.Text2, 0) + Nz(Me.Text3, 0)
End Sub
– Repeat for the other text boxes
– Remove the …_Exit event procedures.
If you still can’t make it work, you might post a stripped down copy of your database. See post 412737 for instructions.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.