Solved

Addition

Posted on 2004-04-18
6
194 Views
Last Modified: 2010-05-02
I would like to know the formatting on the addition of two labels that are numbers.

curPartsandTax1 = Val(txtPartsCharge1.Text) * 1.08
    curLaborHours1 = Val(txtLaborHours1.Text) * 30                        Example
    lblPartsandTax1.Caption = FormatNumber(curPartsandTax1, 2)   59.99
    lblLaborDollars1.Caption = FormatNumber(curLaborHours1, 2)    1,374.00
    lblJobTotal1.Caption = FormatNumber(curPartsandTax1, 2) _
    + FormatNumber(curLaborHours1, 2)                                         59.991,374.00  ???
   
0
Comment
Question by:gonzal13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10855012
lblJobTotal1.Caption = FormatNumber(curPartsandTax1, 2)  + FormatNumber(curLaborHours1, 2)

The FormatNumber() function returns a String object, and the "+" operator means Concatenation for Strings, so try this instead:

lblJobTotal1.Caption = FormatNumber(curPartsandTax1 + curLaborHours1, 2)

Regards,

Idle_Mind
0
 
LVL 13

Author Comment

by:gonzal13
ID: 10954815
Please close out this question

gonzal13(Joe)
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 50 total points
ID: 10959389
Did my solution work gonzal13?

If not, please explain the problem further or post your own solution and request a refund.  

Idle_Mind
0
 
LVL 13

Author Comment

by:gonzal13
ID: 10961616
I had not looked at this site since I had posted another question that helped me get started on the project.

This is the final code:

'Maintain a list box.
'Use dropdown combo box
'Use command Buttons



Private Sub cboClear_Click()

    'The list is named cboCombo1
    'The command clears the Combo1 list
   
    cboCombo1.Clear
   
End Sub

Private Sub cboCombo1_Change()

End Sub

Private Sub cboCount_Click()

    'The ListCount command is used with the message box
    'to view the number of lines in the list
   
    MsgBox "The number of Types is " & cboCombo1.ListCount
End Sub

Private Sub cboPrint_Click()

    'The ListCount returns the number of items in a list
    'If no item is selected, the ListIndex is set to -1.
    'The first item in the list is ListIndex 0 and ListCount
    'is always one more than the largest List Index
    ' Index is a database object that provides access to
    'Data in rows of a table, based on key values.
 
    Dim intIndex As Integer
    Dim intFinalValue As Integer
 
    intFinalValue = cboCombo1.ListCount - 1
    For intIndex = 0 To intFinalValue
    Printer.Print cboCombo1.List(intIndex)
    Next intIndex
    Printer.EndDoc
   
End Sub

    'vbExclamation dislays using the Msb Box a
    'message found in quotes. Usually a warning Message.
    'Private Sub cmdADD_Click()
    '
    'If cboCombo1.Text <> "" Then
    'cboCombo1.AddItem cboCombo1
   
    'Else
    'MsgBox "Blank data", vbExclamation, "Error"
    'End If
    'End Sub


Private Sub cmdExit_Click()

    End
   
End Sub

Private Sub cmdRemove_Click()

   'A combo box control combining the features of a text box
   'and list box.
   'This control allows the user to select an item either
   'by typing into a ComboBox or by selecting it from a list.
   'Remove an item from a ListBox or Combo Box.
   'object.RemoveItem.Index
   'vbInformation Display information using a combo box
   
   If cboCombo1.ListIndex <> -1 Then
    cboCombo1.RemoveItem cboCombo1.ListIndex
    Else
        MsgBox " First select Item to remove", vbInformation, _
        "No Selection made"
   
    End If
   
End Sub

Private Sub cmdSort_Click(Index As Integer)

    'Take the combo box list, name the row and sort

    cboCombo1.Recordset.sort = "bagles"
   
End Sub


'Private Sub mnuADD_Click()

'End Sub
'Private Sub mnuFile_Click()

'End Sub
Private Sub Form_Load()

End Sub


gonzal13(Joe)
0
 
LVL 13

Author Comment

by:gonzal13
ID: 11026175
I would like to close this question out. I klnow all of you had spent time in helping me. Before I looked at any of your comments, I found the answer in the text book. I have 2000 points and would gladly give someone the points, but there are so man notes, that I do not think it is fare to award points to any one person.

Sincerely

gonzal13(Joe)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 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