Solved

Addition

Posted on 2004-04-18
6
191 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

930 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