Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

Performing Calculations in a label

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Umm Husina - 21 May 2007 18:10 GMT
I want to have a label that gives the difference of the values in two text
boxes. For example:

Number_visits and Visits_used are textboxes with number values, and I want
to write something like this in the caption of the label:

=[Number_visits] - [Visits_used]
All I get when I view the form is the line of text I typed above. Am I
missing some part of the syntax like Number_visits.txt or ""?

I would appreciate a hint or help, Thanks.
RBear3 - 21 May 2007 18:29 GMT
Not sure about doing it in a label, but you could create a text box and
place it in the text box.

Signature

Hope that helps!

RBear3
.

>I want to have a label that gives the difference of the values in two text
> boxes. For example:
[quoted text clipped - 7 lines]
>
> I would appreciate a hint or help, Thanks.
fredg - 21 May 2007 19:13 GMT
> I want to have a label that gives the difference of the values in two text
> boxes. For example:
[quoted text clipped - 7 lines]
>
> I would appreciate a hint or help, Thanks.

Label controls cannot be used to perform calculation.
Use an Unbound Text control.
Set it's control source to:

=[Number_Visits]-[Visits_used]

Make sure the name of this control is not the same as the name of any
field used in the expression.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Keith Wilby - 22 May 2007 13:30 GMT
> Label controls cannot be used to perform calculation.

Something like this would work in a form's current event:

Me.Label0.Caption = Me.txtBox1 - Me.txtBox2

Keith.
gumby - 21 May 2007 19:14 GMT
On May 21, 12:10 pm, Umm Husina <Umm Hus...@discussions.microsoft.com>
wrote:
> I want to have a label that gives the difference of the values in two text
> boxes. For example:
[quoted text clipped - 7 lines]
>
> I would appreciate a hint or help, Thanks.

Replace the label with a text box. Them copy your code into the
control sourse of the text box. You can format the text box just like
your label. Also when you add the text box, just delete the associated
label.

David
Steve - 21 May 2007 20:32 GMT
Put the following code in the AfterUpdate event of both textboxes:
Me!LabelName.Caption = NZ(Me![Nimber_Visits],0) - NZ(Me![Visits_Used],0)

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com

>I want to have a label that gives the difference of the values in two text
> boxes. For example:
[quoted text clipped - 7 lines]
>
> I would appreciate a hint or help, Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.