Selasa, 17 April 2012

Pemograman Visual II

  
TUGAS PEMOGRAMAN VISUAL II

MASTER DATA JASA LOUNDRY

 Menu Utama


Listing Menu Utama
Private Sub Form_Load()
Frame1.Visible = False
mnform.Enabled = False
End Sub

Private Sub mnbarang_Click()
frmbarang.Show
End Sub

Private Sub mnmasuk_Click()
Frame1.Visible = True
End Sub



Private Sub mnmember_Click()
frmmember.Show
End Sub

Menu Form Login

 Listing Login
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Adodc4.RecordSource = "select password from admin"
    Adodc4.Refresh
    With Adodc4.Recordset
    .Find ("password='" & Trim(Text2) & "'")
        If .EOF Then
        MsgBox "password anda salah", vbCritical + vbYesNo, "info"
        Text4 = ""
        Text4.Refresh
        Else
        mnform.Enabled = True
        mnmasuk.Enabled = False
        End If
  end With
MsgBox "silahkan pilih menu "
Text1.Enabled = False
Text2.Enabled = False
End If
End Sub


Form Master Barang













Listing Form Master Barang

Dim isibrg As Boolean

Sub nonaktif()
For Each x In Me
If TypeName(x) = "TextBox" Or TypeName(x) = "CommandButton" Then
x.Enabled = False
End If
Next

End Sub
Sub aktif()
For Each x In Me
If TypeName(x) = "TextBox" Or TypeName(x) = "CommandButton" Then
x.Enabled = True
End If
Next

End Sub



Private Sub Command1_Click()
aktif
bersih
isibrg = True
End Sub

Private Sub Command11_Click()
If MsgBox("ingin keluar", vbQuestion + vbYesNo, "info") = vbYes Then
End
End If

End Sub




Sub bersih()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Text = ""
End If
Next
End Sub

Private Sub Command2_Click()
With Adodc2.Recordset
If isibrg = True Then
.AddNew
.Fields("kdbrg") = Text1
.Fields("nmbrg") = Text2
.Fields("harga") = Val(Text3)
.Update
Else
isibrg = False
.Fields("kdbrg") = Text1
.Fields("nmbrg") = Text2
.Fields("harga") = Val(Text3)
.Update
End If
End With
Adodc2.RecordSource = "select*from barang"
Adodc2.Refresh
Adodc2.Refresh
Command5_Click
End Sub

Private Sub Command3_Click()
y = InputBox("masukkan kode", "informasi")
Adodc2.Recordset.Find "kdbrg='" & y & "'"
tampil
isibrg = False
End Sub

Private Sub Command4_Click()
y = InputBox("masukkan kode", "informasi")
Adodc2.Recordset.Find "kdbrg='" & y & "'"
tampil
        If MsgBox("data ingin dihapus ?", vbQuestion + vbYesNo, "info") = vbYes Then
        Adodc2.Recordset.Delete
        MsgBox "data telah dihapus"
        awal
        Else
        awal
        End If
End Sub

Private Sub Command5_Click()
bersih
End Sub

Private Sub Command6_Click()
Adodc2.Recordset.MoveFirst
tampil
MsgBox "data sudah diawal record", vbOKOnly, "info"
End Sub

Private Sub Command7_Click()
Adodc2.Recordset.MovePrevious
If Adodc2.Recordset.BOF Then
MsgBox "data sudah diawal record", vbOKOnly, "info"
Adodc2.Recordset.MoveFirst
End If
tampil
End Sub

Private Sub Command8_Click()
Adodc2.Recordset.MoveNext
If Adodc2.Recordset.EOF Then
MsgBox "data sudah dikhir record", vbOKOnly, "info"
Adodc2.Recordset.MoveLast
End If
tampil
End Sub
Sub tampil()
Text1 = Adodc2.Recordset.Fields("kdbrg")
Text2 = Adodc2.Recordset.Fields("nmbrg")
Text3 = Adodc2.Recordset.Fields("harga")
End Sub
Private Sub Command9_Click()
Adodc2.Recordset.MoveLast
tampil
MsgBox "data sudah diakhir record", vbOKOnly, "info"
End Sub
Sub awal()
Adodc2.RecordSource = "select*from barang"
Adodc2.Refresh
Adodc2.Refresh
End Sub

Private Sub Form_Load()
bersih
nonaktif
Command1.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command11.Enabled = True
End Sub

Private Sub Text4_Change()
Adodc2.RecordSource = "select*from barang where nmbrg like '%" & Text4 & "%'"
Adodc2.Refresh
Adodc2.Refresh
End Sub

Private Sub Text5_Change()
Adodc2.RecordSource = "select*from barang where kdbrg like '%" & Text5 & "%'"
Adodc2.Refresh
Adodc2.Refresh
End Sub









Form Master Member




Listing Form Master Member

Dim isidata As Boolean

Private Sub Command1_Click()
aktif
bersih
isidata = True
End Sub

Private Sub Command11_Click()
If MsgBox("yakin ingin keluar ?", vbQuestion + vbYesNo, "pesan") = vbYes Then
End
End If

End Sub
Sub bersih()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Text = ""
End If
Next
End Sub

Private Sub Command2_Click()
With Adodc1.Recordset
If isidata = True Then
.AddNew
.Fields("kdmember") = Text1
.Fields("nama") = Text2
.Fields("alamat") = Text3
.Update
Else
isidata = False
.Fields("kdmember") = Text1
.Fields("nama") = Text2
.Fields("alamat") = Text3
.Update
End If
End With
MsgBox "data telah tersimpan"
Adodc1.RecordSource = "select*from member"
Adodc1.Refresh
Adodc1.Refresh
Command5_Click
awal
End Sub

Private Sub Command3_Click()
aktif
z = InputBox("masukkan kode", "informasi")
Adodc1.Recordset.Find "kdmember='" & z & "'"
  tampil
  isidata = False
End Sub

Private Sub Command4_Click()
z = InputBox("masukkan kode member", "informasi")
Adodc1.Recordset.Find "kdmember='" & z & "'"
  tampil
    If MsgBox(" data ingin dihapus", vbQuestion + vbYesNo, "info") = vbYes Then
    Adodc1.Recordset.Delete
    MsgBox "data dihapus"
    awal
    Else
    awal
End If
End Sub

Sub awal()
Adodc1.RecordSource = "select*from member"
Adodc1.Refresh
Adodc1.Refresh
bersih
nonaktif
Command1.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command11.Enabled = True
End Sub

Private Sub Command5_Click()
bersih
End Sub
Sub nonaktif()
For Each x In Me
If TypeName(x) = "TextBox" Or TypeName(x) = "CommandButton" Then
x.Enabled = False
End If
Next

End Sub
Sub aktif()
For Each x In Me
If TypeName(x) = "TextBox" Or TypeName(x) = "CommandButton" Then
x.Enabled = True
End If
Next
End Sub
Sub tampil()
Text1 = Adodc1.Recordset.Fields("kdmember")
Text2 = Adodc1.Recordset.Fields("nama")
Text3 = Adodc1.Recordset.Fields("alamat")
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.MoveFirst
tampil
MsgBox "data sudah diawal record", vbInformation + vbOKOnly, "info"
End Sub

Private Sub Command7_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
MsgBox "data sudah diawal record", vbInformation + vbOKOnly, "info "
Adodc1.Recordset.MoveFirst
End If
tampil
End Sub



Private Sub Command8_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox "data sudah diakhir record", vbInformation + vbOKOnly, "info"
Adodc1.Recordset.MoveLast
End If
tampil
End Sub

Private Sub Command9_Click()
Adodc1.Recordset.MoveLast
tampil
MsgBox "data sudah diakhir record", vbInformation + vbOKOnly, "info"
End Sub

Private Sub Form_Load()
nonaktif
Command1.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command11.Enabled = True
End Sub



Private Sub Text4_Change()
Adodc1.RecordSource = "select* from member where nama like '%" & Text4 & "%'"
Adodc1.Refresh
Adodc1.Refresh
End Sub

Private Sub Text5_Change()
Adodc1.RecordSource = "select*from member where kdmember like '%" & Text5 & "%'"
Adodc1.Refresh
Adodc1.Refresh
End Sub



Created : Assisten Oryza


Tidak ada komentar:

Posting Komentar