9 Jan 2012

Membuat Buku Tamu

Program Buku Tamu ini dibuat penulis untuk memberikan contoh kepada vbthok mania supaya dapat mengembangkan ide dari program yang sudah dicontohkan, Bagi yang berpengalaman maaf ini hanya untuk pemula..hehehe...
Tampilan sekilas previewnya seperti ini



dan berikut scriptnya :

Private Sub Command1_Click()
If (Text1.Text <> "") And (Text2.Text <> "") And (Text3.Text <> "") _
And (Text4.Text <> "") Then
Adodc1.RecordSource = "select * from buku"
Adodc1.Refresh
With Adodc1.Recordset
.AddNew
!nama = Text1.Text
!alamat = Text2.Text
!pekerjaan = Text3.Text
!tlp = Text4.Text
.Update
End With
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
Else
MsgBox "data yang anda isi belum lengkap !", vbInformation + vbOKOnly, "Simpan"
Text1.SetFocus
End If
End Sub

Private Sub Command2_Click()
If Frame4.Left = 0 Then
Timer4.Enabled = True
If Frame3.Left = 7800 Then Timer1.Enabled = True
Else
If Frame3.Left = 7800 Then Timer1.Enabled = True
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
End Sub

Private Sub Command3_Click()
If Frame3.Left = 0 Then
Timer2.Enabled = True
If Frame4.Left = 7800 Then Timer3.Enabled = True
Else
If Frame4.Left = 7800 Then Timer3.Enabled = True
End If
Adodc1.RecordSource = "select * from buku order by nama"
Adodc1.Refresh
Combo1.ListIndex = 0
Combo1.SetFocus
Text5.Text = ""
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Command5_Click()
If Frame4.Left = 0 Then
Timer4.Enabled = True
If Frame3.Left = 0 Then Timer1.Enabled = True
End If
If Frame3.Left = 0 Then
Timer2.Enabled = True
If Frame4.Left = 0 Then Timer3.Enabled = True
End If
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
End Sub

Private Sub Text5_Change()
If Combo1.ListIndex = 0 Then
Adodc1.RecordSource = "select * from buku where nama like'%" & _
Text5.Text & "%'"
Adodc1.Refresh

ElseIf Combo1.ListIndex = 1 Then
Adodc1.RecordSource = "select * from buku where alamat like'%" & _
Text5.Text & "%'"
Adodc1.Refresh

ElseIf Combo1.ListIndex = 2 Then
Adodc1.RecordSource = "select * from buku where pekerjaan like'%" & _
Text5.Text & "%'"
Adodc1.Refresh

ElseIf Combo1.ListIndex = 3 Then
Adodc1.RecordSource = "select * from buku where tlp like'%" & _
Text5.Text & "%'"
Adodc1.Refresh
End If
End Sub

Private Sub Timer1_Timer()
Frame3.Left = Frame3.Left - 100
If Frame3.Left = 0 Then Timer1.Enabled = False
End Sub

Private Sub Timer2_Timer()
Frame3.Left = Frame3.Left + 100
If Frame3.Left = 7800 Then Timer2.Enabled = False
End Sub

Private Sub Timer3_Timer()
Frame4.Left = Frame4.Left - 100
If Frame4.Left = 0 Then Timer3.Enabled = False
End Sub

Private Sub Timer4_Timer()
Frame4.Left = Frame4.Left + 100
If Frame4.Left = 7800 Then Timer4.Enabled = False
End Sub

so, mudah bukan...silakan kalian kembangkan sendiri..thanks
Lagi lagi yang gak mo ribet silakan download disini

No comments:

Post a Comment

Garudayasa

Garudayasa