Professional Documents
Culture Documents
Form Model Auto Number
Form Model Auto Number
Frame 1
Frame2
Label1
Label2
Label3
Label4
Item
(Name)
Caption
Height
Width
Caption
Height
Left
Top
Widht
Caption
Height
Left
Top
Widht
BorderStyle
Height
Left
Top
Widht
BorderStyle
Height
Left
Top
Widht
BorderStyle
Height
Left
Top
Widht
BorderStyle
Height
Left
Top
Widht
Properties
Model2AutoNumber
Model Auto Kode
5835
6120
(Kosongkan)
1815
120
600
5655
(Kosongkan)
735
120
2400
5655
1 Fixed Singel
345
129
240
1005
1 Fixed Singel
345
129
600
1005
1 Fixed Singel
345
129
960
1005
1 Fixed Singel
345
129
1320
1005
Label5
Label6
Text1
Text2
Text3
Text4
Text5
Command1
BorderStyle
Height
Left
Top
Widht
Alignment
BorderStyle
FrontSize
Height
Left
Top
Widht
(Name)
Height
Left
Text
Top
Width
(Name)
Height
Left
Text
Top
Width
(Name)
Height
Left
Text
Top
Width
(Name)
Height
Left
Text
Top
Width
(Name)
Height
Left
Text
Top
Width
(Name)
Caption
Height
1 Fixed Singel
345
3120
960
1005
2 - Center
0 None
14
495
0
0
5895
Text1
350
1200
(Kosongkan)
240
1250
Text1
350
1200
(Kosongkan)
600
4260
Text3
350
1200
(Kosongkan)
960
1250
Text4
350
4200
(Kosongkan)
960
1250
Text5
350
1200
(Kosongkan)
1320
1250
CmdInput
&Input
375
Command2
Command3
Command4
Data Grid
Left
Top
Width
(Name)
Caption
Left
(Name)
Caption
Left
(Name)
Caption
Left
Height
Left
Top
Widht
120
240
1000
CmdEdit
&Edit
1200
CmdHapus
&Hapus
2280
CmdTutup
&Tutup
3360
1845
120
3240
5655
4. Buka Kode Editor form (klik 2x pada form) dan isi dengan kode berikut:
Dim mvBookMark As Variant
Private Sub form_activate()
Call BukaDB
Conn.CursorLocation = adUseClient
RSBarang.Open select * from barang, Conn
With RSBarang
If Not (.BOF And .EOF) Then
mvBookMark =.Bookmark
End If
End With
Set DataGrid 1.DataSource = RSBarang.DataSource
End Sub
Sub Form_Load()
batasi jumlah karakter
Text1.MaxLength = 6
Text2.MaxLength = 30
Text3.MaxLength = 8
Text4.MaxLength = 8
Text5.MaxLength = 4
Kondisiawal
End Sub
5. Buka kode editor Command Input (klik 2x pada Input) dan isi dengan kode berikut:
Private Sub CmdInput_click()
If Cmdinput.Caption = &Input Then
Cmdinput.Caption = &Simpan
Cmdedit.Enabled = False
Cmdhapus.Enabled =False
Cmdtutup.Caption = &Batal
SiapIsi
KosongkanText
Call AutoNomor
Text1.Enabled = False
Text2.SetFocus
Else
If Text1 = Or Text2 = Or Text3 = Or Text4 = Or Text5 = Then
MsgBox Data Belum Lengkap!
Else
Dim SQLTambah As String
SQLTambah = Insert Into Barang
(kodeBrg,NamaBrg,HargaBeli,HargaJual,JumlahBrg) values ( & Text1 & , &
Text2 & , & Text3 & . &Text4 . & Text5 & )
Conn.Execute SQLTambah
Form_activate
Call Kondisiawal
End If
End If
End Sub
6. Buka kode editor Command Edit (klik 2x pada Edit) dan isi dengan kode berikut:
8.
9.
Function CariData()
Call BukaDB
RSBarang.Open Select * From Barang Where KodeBrg= & Text1 7 , Conn
End Function
Private Sub Text1_Keypress(Keyascii As Integer)
Keyascii = Asc(UCase(Chr(Keyascii)))
If Keyascii = 13 Then
If Len(Text1) < 6 Then
MsgBox Kode Harus 6 Digit
Text1.SetFocus
Exit Sub
Else
Text2.SetFocus
End If
If Cmdinput.Caption = &Simpan Then
Call CariData
If Not RSBarang.EOF Then
TampilkanData
MsgBox Kode Barang Sudah Ada
KosongkanText
Text1.SetFocus
Else
Text2.SetFocus
End If
End If
If Cmdedit.Caption = &Simpan Then
Call CariData
If Not RSBarang.EOF Then
TampilkanData
Text1.Enabled = False
Text2.SetFocus
Else
MsgBox Kode Barang Tidak Ada
Text1 =
Text1.SetFocus
End If
End If