Add Customer Record To Database


Private Sub cmdAdd_Click()
Dim db As Database, Table As Recordset, KiraRekod 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()

simpanrekod
senaraicustomer
End Sub

Sub simpanrekod()
Dim db As Database, Table As Recordset, KiraTable As Recordset
Set db = Workspaces(0).OpenDatabase(App.Path & “\daftar.mdb”)
Set Table = db.OpenRecordset(“pendaftaran”, dbOpenDynaset)
Set KiraTable = 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, KiraRekod As Recordset, Total As Integer
Set db = Workspaces(0).OpenDatabase(App.Path & “\daftar.mdb”)
Set Table = db.OpenRecordset(“pendaftaran”, dbOpenDynaset)
Set KiraRekod = db.OpenRecordset(“pendaftaran”)
senaraicustomer
End Sub

Sub senaraicustomer()
Dim db As Database, Table As Recordset, KiraRekod As Recordset, Total As Integer
Set db = Workspaces(0).OpenDatabase(App.Path & “\daftar.mdb”)
Set Table = db.OpenRecordset(“pendaftaran”, dbOpenDynaset)
Set KiraRekod = 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

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s