Minggu, 14 Oktober 2012

Menyimpan Data Pelanggan



Private Sub cmdAdd_Click()
    Dim db As Database, Table As Recordset, Pendaftaran As Recordset, Total As Integer
    Set db = Workspaces(0).OpenDatabase(App.Path & "daftar.mdb")
    Set Table = db.OpenRecordset("pendaftaran", dbOpenDynaset)
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Table.AddNew
End Sub

Private Sub cmdsubmit_Click()
    SimpanData
    DataPelanggan
End Sub

Sub SimpanData()
    Dim db As Database, Table As Recordset, dbTabel As Recordset
    Set db = Workspaces(0).OpenDatabase(App.Path & "daftar.mdb")
    Set Table = db.OpenRecordset("pendaftaran", dbOpenDynaset)
    Set dbTabel = db.OpenRecordset("pendaftaran")
    Table.AddNew
    Table("Name") = Text1.Text
    Table("User Login") = Text2.Text
    Table("Password") = Text3.Text
    Table("Email") = Text4.Text
    Table.Update
End Sub

Private Sub Command1_Click()
    Text1.Text = ""
End Sub

Private Sub Command2_Click()
    Text2.Text = ""
End Sub

Private Sub Command3_Click()
    Text3.Text = ""
End Sub

Private Sub Command4_Click()
    Text4.Text = ""
End Sub

Private Sub Command5_Click()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
End Sub

Private Sub Form_Load()
    Dim db As Database, Table As Recordset, Pendaftaran As Recordset, Total As Integer
    Set db = Workspaces(0).OpenDatabase(App.Path & "daftar.mdb")
    Set Table = db.OpenRecordset("pendaftaran", dbOpenDynaset)
    Set Pendaftaran = db.OpenRecordset("pendaftaran")
    DataPelanggan
End Sub

Sub DataPelanggan()
    Dim db As Database, Table As Recordset, Pendaftaran As Recordset, Total As Integer
    Set db = Workspaces(0).OpenDatabase(App.Path & "daftar.mdb")
    Set Table = db.OpenRecordset("pendaftaran", dbOpenDynaset)
    Set Pendaftaran = db.OpenRecordset("pendaftaran")
    If Table.RecordCount = 0 Then
        Exit Sub
    Else
    End If
    List1.Clear
    Table.MoveFirst
    While Not Table.EOF
        List1.AddItem Table("Name")
        Table.MoveNext
    Wend
End Sub

0 komentar:

Posting Komentar

 

© 2011 e - Tutorial | by Moeh Fitrah