Runtime error 91

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • squrel
    New Member
    • Jan 2008
    • 143

    Runtime error 91

    Hello everyone..
    I m working on VB6 and SQLServer 2000.... i m getting an error in this line..


    Private Sub txtAdjAmt_KeyPr ess(KeyAscii As Integer)
    Dim vI As Integer
    vI = LVPO.SelectedIt em.Index
    If KeyAscii = 13 Then
    LVPO.ListItems( vI).SubItems(4) = txtAdjAmt.Text
    txtAdjAmt.Visib le = False
    End If

    Dim vI1 As Integer
    vI1 = LvBill.Selected Item.Index
    If KeyAscii = 13 Then
    LvBill.ListItem s(vI1).SubItems (4) = txtAdjAmt.Text
    txtAdjAmt.Visib le = False
    End If
    End Sub


    is anyone there to help me out to remove the error... there is a textbox when i press any key it give an error as " object variable or with block variable not set"
    plz help me.
    thank u in advance
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    May be, No Item is selected in the list view "LvBill"

    Regards
    Veena

    Comment

    • squrel
      New Member
      • Jan 2008
      • 143

      #3
      Hi

      the selection is done bt still i m getting the same error.
      can u help me out
      thank u

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        How are you populating "lvBill"... .?

        Comment

        • squrel
          New Member
          • Jan 2008
          • 143

          #5
          Private Sub LvBill_KeyPress (KeyAscii As Integer)
          Dim vI1 As Integer
          'If cmbpayType.Text = "B" Then
          If LvBill.CheckBox es = True Then
          vI1 = LvBill.Selected Item.Index
          txtadjamt1.Left = LvBill.ColumnHe aders(5).Left + 280

          txtadjamt1.Top = LvBill.ListItem s(vI1).Top + 3600
          txtadjamt1.Heig ht = LvBill.ListItem s(vI1).Height
          txtadjamt1.Widt h = LvBill.ColumnHe aders(5).Width
          txtadjamt1.Visi ble = True
          txtadjamt1.Text = ""
          txtadjamt1.SetF ocus
          End If
          'End If
          End Sub


          this is my lvbill... i have one more lvbillpo which by filling up the lvbill and saving the listview wil show.. i have to set the adjamt and tdsamt in the lvbill to get tht..

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Hi,

            Change you Code like this and Check :

            [code=vb]
            Private Sub txtAdjAmt_KeyPr ess(KeyAscii As Integer)
            Dim vI As Integer
            If KeyAscii = 13 Then
            vI = LVPO.SelectedIt em.Index
            LVPO.ListItems( vI).SubItems(4) = txtAdjAmt.Text
            txtAdjAmt.Visib le = False
            End If

            Dim vI1 As Integer
            If KeyAscii = 13 Then
            vI1 = LvBill.Selected Item.Index
            LvBill.ListItem s(vI1).SubItems (4) = txtAdjAmt.Text
            txtAdjAmt.Visib le = False
            End If
            End Sub
            [/code]

            Regards
            Veena

            Comment

            • squrel
              New Member
              • Jan 2008
              • 143

              #7
              ok.. thank u very much

              Comment

              Working...