Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21845

[RESOLVED] how to enter only 1 thing in listview

$
0
0
hey
im trying to enter only 1 thing in the listview i get error object variable
this is the code
Code:

    If NewRec Then
        Dim NewID As Long
        NewID = NextID("HairID", "HairDressers")
        Dim strSQL As String
strSQL = "INSERT INTO HairDressers "
strSQL = strSQL & "(HairID, HairDressers) "
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "'" & RplS(Txt(0).text) & "'"
strSQL = strSQL & ")"
CN.Execute strSQL
        Set Itm = FrmHairdressers.LsVw.ListItems.Add(, , Txt(0).text, , "hair")
        Itm.Tag = NewID
        Itm.SubItems(1) = Txt(0).text
        If ChkRepeat.Value Then
            Txt(0).text = ""
            Exit Sub
        End If
    Else
        With FrmHairdressers.LsVw.SelectedItem
        strSQL = "UPDATE HairDressers SET "
strSQL = strSQL & "HairName = '" & RplS(Txt(0).text) & "'"
strSQL = strSQL & " WHERE HairID = " & .Tag
CN.Execute strSQL
            Txt(0).text = .text
        End With
    End If
    Unload Me

tnx for the help

Viewing all articles
Browse latest Browse all 21845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>