help with Command buttons in VB 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cmvw
    New Member
    • Jun 2006
    • 1

    help with Command buttons in VB 6.0

    I keep getting runtime 424 error object required when tring to run program works fine untill it gets to caculate commission any assistants would be appreciated.








    Private Sub cmdCalc_Click()
    'caculate total commission
    lblCommision.Ca ption = Val(txtSales.Te xt) * Val(txtRate.Tex t)
    lblCommission.C aption = Format(lblCommi ssion.Caption, "currency")
    cmdPrint.SetFoc us

    End Sub

    Private Sub cmdClear_Click( )
    'Clears screen for next commission.
    txtName.Text = ""
    txtSales.Text = ""
    txtTerritory.Te xt = ""
    lbtsales.Captio n = ""
    txtRate.Text = ".10"
    lblCommision.Te xt = ""
    txtName.setfouc us


    End Sub

    Private Sub cmdExit_Click()
    End
    End Sub

    Private Sub cmdPrint_Click( )
    ' Hide command buttons before printing.
    cmdCalc.Visible = False
    cmdPrint.Visibl e = False
    cmdClear.Visibl e = False
    cmdExit.Visible = False

    PrintForm
    'displays command buttons after form is printed
    cmdCalc.Visible = True
    cmdPrint.Visibl e = True
    cmdClear.Visibl e = True
    cmdExit.Visible = True
    cmdClear.SetFoc us

    End Sub


    Private Sub Label3_Click()



    End Sub

    Private Sub Label5_Click()
    .

    End Sub

    Private Sub lblcomission_Cl ick()

    End Sub

    Private Sub Label1_Click()

    End Sub

    Private Sub txtRate_Change( )
    txtRate.Text = Val(0.1)
    End Sub
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    always remember when u get the "object required" error msg that means u are using some control name that doesn't exist or has been deleted from the container or the form.. check the form properties by pressing F4 or another shortcut is.. the name of the deleted control will apprear under the form general declare section..

    it could be any label, command button, textbox.. or perhaps make sure the naming convention of every control is same under the cmdCalc() as well as the contol properties..

    tips to make sure the naming convention is followed.. always start your line of code with the "me." keyword.. i.e. "me." .. when you type the "me." keyword.. all the controls on the form is listed.. check it out.. good luck my fren
    Last edited by sashi; Jun 18 '06, 02:06 PM.

    Comment

    • CaptainD
      New Member
      • Mar 2006
      • 135

      #3
      Do a spell check, one of your lables is spelled wrong.
      lblCommision.Ca ption = Val(txtSales.Te xt) * Val(txtRate.Tex t)
      lblCommission.C aption = Format(lblCommi ssion.Caption, "currency")

      Comment

      • sashi
        Recognized Expert Top Contributor
        • Jun 2006
        • 1749

        #4
        Hi CaptionD,

        thanks for highlighting that portion of the code.. gee i almost missed that out.. take care buddy.. :)

        Comment

        Working...