Solved

Addition

Posted on 2004-04-18
6
190 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
  • 3
  • 2
6 Comments
 
LVL 85

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 85

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now