Rabu, 28 Maret 2012

DataBase Microsoft Visual Basic 6.0

Rumus/Syntax DataBase Pada Text
Sebelum menuliskan Syntax pastikan name data anda sesuai dengan yang anda tuliskan disyntax anda.

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Data1.Recordset.Index = "KODE_BARANG" (Indexs pada VisData yang anda buat, pastikan sama)
Data1.Recordset.Seek "=", Text1.Text (letak text pada input kode)
If Not Data1.Recordset.NoMatch Then
MsgBox ("DATA ADA")
BERSIH
Else
Text2.SetFocus
End If
End If
End Sub
untuk Text berikutnya anda cuma menambahkan rumus/syntax enter.
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

untuk rumus berikut ini adalah rumus untuk perkalian antar harga dan jumlah.
Private Sub Text4_Change()
Text5.Text = Val(Text3.Text) * Val(Text4.Text)
End Sub


Tidak ada komentar:

Posting Komentar