Minggu, 28 Mei 2017

Kode Program Membuat Aplikasi Database Satu Tabel Dengan Bahasa Pemrograman Visual Basic 6 (VB6)

Kode Program Membuat Aplikasi Database Satu Tabel Dengan Bahasa Pemrograman Visual Basic 6 (VB6)

VB6


Kode Program (listing kode) nya
Form1.frm
VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TabCtl32.Ocx"
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   8025
   ClientLeft      =   1065
   ClientTop       =   1455
   ClientWidth     =   10380
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   8025
   ScaleWidth      =   10380
   Begin MSDBGrid.DBGrid DBGrid1
      Bindings        =   "Form1.frx":0000
      Height          =   1095
      Left            =   240
      OleObjectBlob   =   "Form1.frx":0014
      TabIndex        =   41
      Top             =   6720
      Width           =   9735
   End
   Begin VB.Data Data1
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "D:\Data Agus\Acsptun98.mdb"
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   480
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "brgptun"
      Top             =   360
      Width           =   2775
   End
   Begin TabDlg.SSTab SSTab1
      Height          =   1695
      Left            =   5400
      TabIndex        =   37
      Top             =   4560
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   2990
      _Version        =   393216
      TabHeight       =   520
      TabCaption(0)   =   "Tab 0"
      TabPicture(0)   =   "Form1.frx":09E7
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "Text8"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).Control(1)=   "Command16"
      Tab(0).Control(1).Enabled=   0   'False
      Tab(0).Control(2)=   "Command17"
      Tab(0).Control(2).Enabled=   0   'False
      Tab(0).ControlCount=   3
      TabCaption(1)   =   "Tab 1"
      TabPicture(1)   =   "Form1.frx":0A03
      Tab(1).ControlEnabled=   0   'False
      Tab(1).ControlCount=   0
      TabCaption(2)   =   "Tab 2"
      TabPicture(2)   =   "Form1.frx":0A1F
      Tab(2).ControlEnabled=   0   'False
      Tab(2).ControlCount=   0
      Begin VB.CommandButton Command17
         Caption         =   "End Filter"
         Height          =   375
         Left            =   1320
         TabIndex        =   40
         Top             =   1200
         Width           =   1215
      End
      Begin VB.CommandButton Command16
         Caption         =   "Filter"
         Height          =   375
         Left            =   120
         TabIndex        =   39
         Top             =   1200
         Width           =   1095
      End
      Begin VB.TextBox Text8
         Height          =   375
         Left            =   240
         TabIndex        =   38
         Top             =   600
         Width           =   2175
      End
   End
   Begin VB.CommandButton Command15
      Caption         =   "Report"
      Height          =   375
      Left            =   5640
      TabIndex        =   30
      Top             =   3960
      Width           =   1095
   End
   Begin VB.CommandButton Command14
      Caption         =   "Cancel Add/ Save + Edit"
      Height          =   375
      Left            =   480
      TabIndex        =   29
      Top             =   5880
      Width           =   2295
   End
   Begin VB.CommandButton Command13
      Caption         =   "View"
      Height          =   375
      Left            =   5880
      TabIndex        =   28
      Top             =   3000
      Width           =   855
   End
   Begin VB.PictureBox Picture1
      Height          =   1935
      Left            =   8160
      ScaleHeight     =   1875
      ScaleWidth      =   2115
      TabIndex        =   27
      Top             =   600
      Width           =   2175
   End
   Begin VB.TextBox Text7
      Height          =   375
      Left            =   5760
      TabIndex        =   26
      Top             =   1080
      Width           =   2175
   End
   Begin VB.CommandButton Command12
      Caption         =   "End Find"
      Height          =   375
      Left            =   6840
      TabIndex        =   25
      Top             =   1680
      Width           =   975
   End
   Begin VB.CommandButton Command11
      Caption         =   "Find"
      Height          =   375
      Left            =   5880
      TabIndex        =   24
      Top             =   1680
      Width           =   855
   End
   Begin VB.CommandButton Command10
      Caption         =   "Exit"
      Height          =   375
      Left            =   4080
      TabIndex        =   23
      Top             =   5880
      Width           =   1095
   End
   Begin VB.CommandButton Command9
      Caption         =   "Delete"
      Height          =   375
      Left            =   2880
      TabIndex        =   22
      Top             =   5880
      Width           =   1095
   End
   Begin VB.CommandButton Command8
      Caption         =   "Edit"
      Height          =   375
      Left            =   4080
      TabIndex        =   21
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton Command7
      Caption         =   "Siap Edit"
      Height          =   375
      Left            =   2880
      TabIndex        =   20
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton Command6
      Caption         =   "Save"
      Height          =   375
      Left            =   1680
      TabIndex        =   19
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton Command5
      Caption         =   "Add"
      Height          =   375
      Left            =   480
      TabIndex        =   18
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton Command4
      Height          =   375
      Left            =   4080
      Picture         =   "Form1.frx":0A3B
      Style           =   1  'Graphical
      TabIndex        =   17
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton Command3
      Height          =   375
      Left            =   2880
      Picture         =   "Form1.frx":0B89
      Style           =   1  'Graphical
      TabIndex        =   16
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton Command2
      Height          =   375
      Left            =   1680
      Picture         =   "Form1.frx":0CD7
      Style           =   1  'Graphical
      TabIndex        =   15
      Top             =   4920
      Width           =   1095
   End
   Begin VB.TextBox Text6
      DataField       =   "pictfilewebbrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   6
      Top             =   4200
      Width           =   2415
   End
   Begin VB.TextBox Text5
      DataField       =   "vabrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   5
      Top             =   3600
      Width           =   2415
   End
   Begin VB.TextBox Text4
      DataField       =   "pictfilebrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   4
      Top             =   3000
      Width           =   2415
   End
   Begin VB.TextBox Text3
      DataField       =   "typebrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   3
      Top             =   2400
      Width           =   2415
   End
   Begin VB.TextBox Text2
      DataField       =   "nmbrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   2
      Top             =   1680
      Width           =   2415
   End
   Begin VB.TextBox Text1
      DataField       =   "kbrgptun"
      DataSource      =   "Data1"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   1080
      Width           =   2415
   End
   Begin VB.CommandButton Command1
      Height          =   375
      Left            =   480
      Picture         =   "Form1.frx":0E25
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4920
      Width           =   1095
   End
   Begin VB.Line Line8
      X1              =   9960
      X2              =   9960
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line7
      X1              =   8400
      X2              =   8400
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line6
      X1              =   6840
      X2              =   6840
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line5
      X1              =   5280
      X2              =   5280
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line4
      X1              =   3720
      X2              =   3720
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line3
      Index           =   2
      X1              =   0
      X2              =   0
      Y1              =   0
      Y2              =   360
   End
   Begin VB.Line Line3
      Index           =   1
      X1              =   0
      X2              =   0
      Y1              =   0
      Y2              =   360
   End
   Begin VB.Line Line3
      Index           =   0
      X1              =   2160
      X2              =   2160
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line2
      X1              =   240
      X2              =   240
      Y1              =   6360
      Y2              =   6720
   End
   Begin VB.Line Line1
      X1              =   240
      X2              =   9960
      Y1              =   6360
      Y2              =   6360
   End
   Begin VB.Label Label13
      Caption         =   "Kode Barang"
      Height          =   255
      Left            =   840
      TabIndex        =   36
      Top             =   6480
      Width           =   1095
   End
   Begin VB.Label Label12
      Caption         =   "Nama Barang"
      Height          =   255
      Left            =   2400
      TabIndex        =   35
      Top             =   6480
      Width           =   1095
   End
   Begin VB.Label Label11
      Caption         =   "Type Barang"
      Height          =   255
      Left            =   4080
      TabIndex        =   34
      Top             =   6480
      Width           =   975
   End
   Begin VB.Label Label10
      Caption         =   "Picture File"
      Height          =   255
      Left            =   5640
      TabIndex        =   33
      Top             =   6480
      Width           =   855
   End
   Begin VB.Label Label9
      Caption         =   "VA Barang"
      Height          =   255
      Left            =   7200
      TabIndex        =   32
      Top             =   6480
      Width           =   855
   End
   Begin VB.Label Label8
      Caption         =   "Picture Web"
      Height          =   255
      Left            =   8760
      TabIndex        =   31
      Top             =   6480
      Width           =   1095
   End
   Begin VB.Label Label7
      Caption         =   "DATA/ DAFTAR BARANG"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3720
      TabIndex        =   14
      Top             =   120
      Width           =   3615
   End
   Begin VB.Label Label6
      Caption         =   "Picture Web"
      Height          =   255
      Left            =   600
      TabIndex        =   13
      Top             =   4200
      Width           =   1815
   End
   Begin VB.Label Label5
      Caption         =   "VA Barang"
      Height          =   255
      Left            =   600
      TabIndex        =   12
      Top             =   3600
      Width           =   1575
   End
   Begin VB.Label Label4
      Caption         =   "Picture File"
      Height          =   255
      Left            =   600
      TabIndex        =   11
      Top             =   3000
      Width           =   1455
   End
   Begin VB.Label Label3
      Caption         =   "Type Barang"
      Height          =   255
      Left            =   600
      TabIndex        =   10
      Top             =   2400
      Width           =   1695
   End
   Begin VB.Label Label2
      Caption         =   "Nama Barang"
      Height          =   255
      Left            =   600
      TabIndex        =   9
      Top             =   1680
      Width           =   1695
   End
   Begin VB.Label Label1
      Caption         =   "Kode Barang"
      Height          =   255
      Left            =   600
      TabIndex        =   8
      Top             =   1080
      Width           =   1455
   End
   Begin VB.OLE OLE1
      Class           =   "Paint.Picture"
      DataField       =   "pictbrgptun"
      DataSource      =   "Data1"
      Height          =   1935
      Left            =   8160
      OleObjectBlob   =   "Form1.frx":0F73
      TabIndex        =   7
      Top             =   2640
      Width           =   2175
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
End Sub

Private Sub Command10_Click()
Unload Me
End Sub

Private Sub Command11_Click()
Dim msyarat As String
mkode = Trim(Text7.Text)
msyarat = mkode
Data1.Recordset.Index = "kbrgptunx"
Data1.Recordset.Seek "=", msyarat
If Data1.Recordset.NoMatch Then
MsgBox "Data tidak ada", 16, "Informasi"
End If
End Sub

Private Sub Command12_Click()
Text7.Text = ""
End Sub

Private Sub Command13_Click()
Picture1.Picture = LoadPicture(Text4.Text)
End Sub

Private Sub Command14_Click()
Data1.Recordset.CancelUpdate
Command6.Enabled = False
Command8.Enabled = False
End Sub

Private Sub Command15_Click()
DataReport1.Show
End Sub

Private Sub Command16_Click()
Data1.Recordset.Filter = "kbrgptun='" & Text8.Text & "'"
Data1.Recordset.Fields.Refresh
Data1.Refresh
End Sub

Private Sub Command2_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
MsgBox "Sudah di awal record", 48, "Informasi"
End If
End Sub

Private Sub Command3_Click()
Data1.Recordset.MoveNext

If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
MsgBox "Sudah di akhir record", 48, "Informasi"
End If
End Sub

Private Sub Command4_Click()
Data1.Recordset.MoveLast
End Sub

Private Sub Command5_Click()
Data1.Recordset.AddNew
Text1.SetFocus
Command6.Enabled = True
End Sub

Private Sub Command6_Click()
Data1.Recordset.Update
Command6.Enabled = False
End Sub

Private Sub Command7_Click()
Command8.Enabled = True
Text1.SetFocus
End Sub

Private Sub Command8_Click()
Data1.Recordset.Edit
Command8.Enabled = False
End Sub

Private Sub Command9_Click()
del = MsgBox("Apakah Data akan dihapus", 36, "Informasi")
If del = 6 Then

Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Data1.Recordset.Delete

End If
End Sub

Private Sub Form_Activate()
Command6.Enabled = False
Command8.Enabled = False
End Sub





Tidak ada komentar:

Posting Komentar