Jumat, 20 Juni 2014

Membuat Input Box di vb6

Private Sub Cmdhapus_Click()
Dim xhapus As String
xhapus = InputBox("Ketik No. Cust yang akan di hapus", "Lookup")
If StrPtr(xhapus) = 0 Then
            'Kode InputBox Cancel
            'MsgBox "You pressed cancel!"
ElseIf Len(xhapus) = 0 Then
        MsgBox "Anda Harus Mengisi Kode, tidak boleh kosong", vbInformation, "Hapus"
Else
    Adocustomer.RecordSource = "select * from customer where nocust='" & Trim(xhapus) & "'"
    Adocustomer.Refresh
    If Adocustomer.Recordset.RecordCount > 0 Then
        Adocustomer.Recordset.Delete
        Adocustomer.Refresh
        MsgBox "Data telah terhapus"
    Else
        MsgBox "No. Cust yang anda masukkan tidak ada"
    End If
End If
    Adocustomer.RecordSource = "select * from customer"
    Adocustomer.Refresh
End Sub

Tidak ada komentar:

Posting Komentar

hay friend... sebelum exit, jgn lupa tinggalkan comment dulu ya...
kalau mau bertanya bisa tulis komentar atau email/fb ke: aranama@ymail.com
thank you...