+ Reply to Thread
Results 1 to 2 of 2

How do I?

  1. #1
    Greg
    Guest

    How do I?

    How do I add the total of two tetboxes together in vb code. I need the total
    displayed in a textbox called "total"
    the textboxes are "f5" & "f6"

    Thanks

    Greg



  2. #2
    Barry-Jon
    Guest

    Re: How do I?

    Use the chaneg events for the two "input" boxes to call a proc that
    will update the total box. You will also need to handle errors and
    non-numeric input. The basics are below. Please let me know if this
    is what you were looking for.

    Private Sub f5_Change()

    RecalcTotal

    End Sub

    Private Sub f6_Change()

    RecalcTotal

    End Sub

    Private Sub RecalcTotal()

    Dim dblF5 As Double
    Dim dblF6 As Double

    If IsNumeric(Me.f5.Value) And IsNumeric(Me.f6.Value) Then

    dblF5 = CDbl(Me.f5.Value)
    dblF6 = CDbl(Me.f6.Value)

    Me.total.Value = dblF5 + dblF6

    Else

    'handle non numeric input here

    End If

    End Sub


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1