koding cari vb6
DESCRIPTION
program vb 6TRANSCRIPT
Option Explicit
Public action As String
'# PROSEDUR UNTUK MENDESAIN GRID TAMPIL
Public Sub AktifMSgridcariwell()
With MSGridwell
' Atur Jumlah kolom
.Cols = 8
' Kolom Pertama (Col 0)
.RowHeightMin = 300
.Col = 0
.Row = 0
.Text = "NO"
.CellFontBold = True
.ColWidth(0) = 700
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Kedua (Col 1)
.Col = 1
.Row = 0
.Text = "No Well"
.CellFontBold = True
.ColWidth(1) = 1500
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Kedua (Col 2)
.Col = 2
.Row = 0
.Text = "Well Name"
.CellFontBold = True
.ColWidth(2) = 1500
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Ketiga (Col 3)
.Col = 3
.Row = 0
.Text = "Area"
.CellFontBold = True
.ColWidth(3) = 1000
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Ketiga (Col 4)
.Col = 4
.Row = 0
.Text = "Pumping Unit Type"
.CellFontBold = True
.ColWidth(4) = 2000
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Ketiga (Col 5)
.Col = 5
.Row = 0
.Text = "Crank No"
.CellFontBold = True
.ColWidth(5) = 1000
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Ketiga (Col 6)
.Col = 6
.Row = 0
.Text = "CW_CCW"
.CellFontBold = True
.ColWidth(6) = 1200
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
' Kolom Ketiga (Col 7)
.Col = 7
.Row = 0
.Text = "Type HP Motor "
.CellFontBold = True
.ColWidth(7) = 2000
.AllowUserResizing = flexResizeColumns
.CellAlignment = flexAlignCenterCenter
End With
End Sub
'# PROSEDUR UNTUK MENAMPILKAN DATA KE GRID
Public Sub TampilGridDatawell()
Dim Baris As Integer
MSGridwell.Clear
Call AktifMSgridcariwell
MSGridwell.Rows = 2
Baris = 0
'# DATA STANDAR PADA GRID
Set rswell = New ADODB.Recordset
rswell.Open "SELECT * " _
& " FROM tbwell, tbchecked WHERE tbchecked.NoWell=tbwell.NoWell ORDER BY tbchecked.NoWell", _
conn, adOpenDynamic, adLockBatchOptimistic
If Not rswell.BOF Then
With rswell
.MoveFirst
Do While Not .EOF
On Error Resume Next
Baris = Baris + 1
MSGridwell.Rows = Baris + 1
MSGridwell.TextMatrix(Baris, 0) = Baris
MSGridwell.TextMatrix(Baris, 1) = !NoWell
MSGridwell.TextMatrix(Baris, 2) = !wellname
MSGridwell.TextMatrix(Baris, 3) = !area
MSGridwell.TextMatrix(Baris, 4) = !PumpingUnitType
MSGridwell.TextMatrix(Baris, 5) = !crankno
MSGridwell.TextMatrix(Baris, 6) = !cw_ccw
MSGridwell.TextMatrix(Baris, 7) = !Type_HPMotor
.MoveNext
Loop
End With
End If
End Sub
Public Sub PencarianData()
Dim Baris As Integer
MSGridwell.Clear
Call AktifMSgridcariwell
MSGridwell.Rows = 2
Baris = 0
'# DATA STANDAR PADA GRID
Set rswellsearch = New ADODB.Recordset
If action = "Add" Then
rswellsearch.Open "SELECT * " _
& " FROM tbwell WHERE NoWell NOT IN (SELECT NoWell FROM tbchecked) AND NoWell='" & txtcariwell.Text & "'" _
& " ORDER BY NoWell", _
conn, adOpenDynamic, adLockBatchOptimistic
If rswellsearch.BOF Then
Set rswellsearch = New ADODB.Recordset
rswellsearch.Open "SELECT * " _
& " FROM tbwell WHERE NoWell NOT IN (SELECT NoWell FROM tbchecked) AND WellName LIKE '%" & txtcariwell.Text & "%'" _
& " ORDER BY NoWell", _
conn, adOpenDynamic, adLockBatchOptimistic
End If
ElseIf action = "Edit" Then
rswellsearch.Open "SELECT * " _
& " FROM tbwell WHERE NoWell IN (SELECT NoWell FROM tbchecked) AND NoWell='" & txtcariwell.Text & "'" _
& " ORDER BY NoWell", _
conn, adOpenDynamic, adLockBatchOptimistic
If rswellsearch.BOF Then
Set rswellsearch = New ADODB.Recordset
rswellsearch.Open "SELECT * " _
& " FROM tbwell WHERE NoWell IN (SELECT NoWell FROM tbchecked) AND WellName LIKE '%" & txtcariwell.Text & "%'" _
& " ORDER BY NoWell", _
conn, adOpenDynamic, adLockBatchOptimistic
End If
End If
If Not rswellsearch.BOF Then
With rswellsearch
.MoveFirst
Do While Not .EOF
On Error Resume Next
Baris = Baris + 1
MSGridwell.Rows = Baris + 1
MSGridwell.TextMatrix(Baris, 0) = Baris
MSGridwell.TextMatrix(Baris, 1) = !NoWell
MSGridwell.TextMatrix(Baris, 2) = !wellname
MSGridwell.TextMatrix(Baris, 3) = !area
MSGridwell.TextMatrix(Baris, 4) = !PumpingUnitType
MSGridwell.TextMatrix(Baris, 5) = !crankno
MSGridwell.TextMatrix(Baris, 6) = !cw_ccw
MSGridwell.TextMatrix(Baris, 7) = !Type_HPMotor
.MoveNext
Loop
End With
End If
End Sub
Private Sub Form_Load()
Call koneksi
Call TampilGridDatawell
End Sub
Private Sub MSGridwell_DblClick()
Dim j As Integer
j = MSGridwell.Row
On Error Resume Next
If MSGridwell.Rows >= 1 Then
Set rswellsearch = New ADODB.Recordset
If action = "Add" Then
rswellsearch.Open "SELECT * " _
& " FROM tbwell WHERE NoWell='" & MSGridwell.TextMatrix(j, 1) & "'",_
conn, adOpenDynamic, adLockOptimistic
ElseIf action = "Edit" Then
rswellsearch.Open "SELECT * " _
& " FROM tbwell, tbchecked " _
& " WHERE tbwell.NoWell=tbchecked.NoWell " _
& " AND tbchecked.NoWell ='" & MSGridwell.TextMatrix(j, 1) & "'", _
conn, adOpenDynamic, adLockOptimistic
End If
If Not rswellsearch.BOF Then
With frmChecked
If action = "Add" Then
.txtnowell.Text = rswellsearch!NoWell
ElseIf action = "Edit" Then
.txtnoinput.Text = rswellsearch!Noinput
.dtINPUT.Value = rswellsearch!TglInput
.txtbadge.Text = rswellsearch!Nobadge
.txtnowell.Text = rswellsearch!NoWell
.cmbload.Text = rswellsearch!LoadCell
.cmblc.Text = rswellsearch!LC_Cable
.cmbdps.Text = rswellsearch!DPS_PosSwitch
.cmbswitch.Text = rswellsearch!SwitchCableSensor
.cmbrpc.Text = rswellsearch!RPCBoard
.cmbai.Text = rswellsearch!AIBoard
.cmbpole.Text = rswellsearch!PoleRPC
.cmbcanopy.Text = rswellsearch!Canopy
.cmbconcrete.Text = rswellsearch!Concrete
.cmbpower.Text = rswellsearch!PowerSupply
.txtmodem.Text = rswellsearch!COMMMODEM
.txtantenna.Text = rswellsearch!commantenna
.cmbpt.Text = rswellsearch!pt
.cmbptc.Text = rswellsearch!PTCable
.cmbtt.Text = rswellsearch!tt
.cmbttc.Text = rswellsearch!TTCable
.txtremarks.Text = rswellsearch!REMARKS
End If
End With
Unload Me
frmChecked.cmbload.SetFocus
End If
Else
Exit Sub
End If
End Sub
Private Sub txtcariwell_Change()
Call PencarianData
End Sub
Private Sub txtCaridosen_Click()
txtcariwell.Text = ""
End Sub