VISUAL BASIC (SSTab)

Sub tulisdata()

Dim i As Integer

i = 0

Do While Not rsmahasiswa.EOF

i = i + 1

grid.AddItem (i & vbTab & rsmahasiswa(0) & vbTab & rsmahasiswa(1) & vbTab & rsmahasiswa(2) & vbTab & rsmahasiswa(3) & rsmahasiswa(4) & vbTab & rsmahasiswa(5)) & rsmahasiswa.MoveNext

 

End Sub

 

 

Private Sub cbokelass_Click(Index As Integer)

Dim kelas As Variant

Select Case cbokelas.Text

Case “BISNIS”

Case “EKSEKUTIF”

Case “EKONOMI”

End Select

End Sub

 

 

Private Sub cboR_Change()

Dim cboR As Variant

Select Case Combo1.Text

Case “SURABAYA-JAKARTA”

txtnotransaksi.Text = “01″

Case “SURABAYA-DENPASAR”

txtnotransaksi.Text = “02″

Case “SURABAYA-BALIKPAPAN”

txtnotransaksi.Text = “03″

Case “SURABAYA-MEDAN”

txtnotransaksi.Text = “04″

Case “SURABAYA-LOMBOK”

txtnotransaksi.Text = “05″

Case “SURABAYA-SOLO”

txtnotransaksi.Text = “06″

Case “JAKARTA-SURABAYA”

txtnotransaksi.Text = “07″

Case “DENPASAR-SURABAYA”

txtnotransaksi.Text = “08″

Case “BALIKPAPAN-SURABAYA”

txtnotransaksi.Text = “09″

Case “MEDAN-SURABAYA”

txtnotransaksi.Text = “10″

Case “LOMBOK-SURABAYA”

txtnotransaksi.Text = “11″

Case “SOLO-SURABAYA”

txtnotransaksi.Text = “12″

Case “LAMPUNG-JAKARTA”

txtnotransaksi.Text = “13″

Case “JAKARTA-LAMPUNG”

txtnotransaksi.Text = “14″

End Select

End Sub

 

Private Sub cmdbaru_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub cmdhapus_Click()

Data1.Recordset.Delete

txtkodetiket.SetFocus

End Sub

 

Private Sub cmdnew_Click()

txtnama.SetFocus

txtnotransaksi.Text = “000″

txtnama.Text = “”

txtalamat.Text = “”

txttelp.Text = “”

Combo1.Text = “”

Combo2.Text = “”

txttiket.Text = “”

txtharga.Text = “”

txttotal.Text = “”

txttanggal.Text = “”

End Sub

 

Private Sub cmdplus_Click()

Combo1.Text = “”

Combo2.Text = “”

txttiket.Text = “”

txtharga.Text = “”

Combo1.SetFocus

txttanggal.Text = “”

End Sub

 

 

Private Sub Cmdsimpan_Click()

Data1.Recordset.Update

End Sub

Private Sub cmdubah_Click()

Data1.Recordset.Edit

End Sub

 

Private Sub Combo1_CLICK()

Dim COMBO As Variant

Select Case Combo1.Text

Case “SURABAYA-JAKARTA”

txtnotransaksi.Text = “001″

Case “SURABAYA-DENPASAR”

txtnotransaksi.Text = “002″

Case “SURABAYA-BALIKPAPAN”

txtnotransaksi.Text = “003″

Case “SURABAYA-MEDAN”

txtnotransaksi.Text = “005″

Case “SURABAYA-SOLO”

txtnotransaksi.Text = “006″

Case “JAKARTA-SURABAYA”

txtnotransaksi.Text = “007″

Case “DENPASAR-SURABAYA”

txtnotransaksi.Text = “008″

Case “BALIKPAPAN-SURABAYA”

txtnotransaksi.Text = “009″

Case “MEDAN-SURABAYA”

txtnotransaksi.Text = “010″

Case “LOMBOK-SURABAYA”

txtnotransaksi.Text = “011″

Case “SOLO-SURABAYA”

txtnotransaksi.Text = “012″

Case “LAMPUNG-JAKARTA”

txtnotransaksi.Text = “013″

Case “JAKARTA-LAMPUNG”

txtnotransaksi.Text = “014″

 

End Select

 

End Sub

 

Private Sub Combo3_click()

Dim Combo3 As Variant

Select Case Combo3

Case “BISNIS”

Case “EKSEKUTIF”

Case “EKONOMI”

End Select

End Sub

 

Private Sub Form_Load()

openconnection

Set rsmahasiswa = New ADODB.Recordset

rsmahasiswa.Open “select * from tbok”, con, adOpenStatic, adLockOptimistic

Combo1.AddItem “”

Combo1.AddItem “”

 

Combo1.AddItem “SURABAYA-JAKARTA”

Combo1.AddItem “SURABAYA-DENPASAR”

Combo1.AddItem “SURABAYA-BALIKPAPAN”

Combo1.AddItem “SURABAYA-MEDAN”

Combo1.AddItem “SURABAYA-LOMBOK”

Combo1.AddItem “SURABAYA-SOLO”

Combo1.AddItem “JAKARTA-SURABAYA”

Combo1.AddItem “DENPASAR-SURABAYA”

Combo1.AddItem “BALIKPAPAN-SURABAYA”

Combo1.AddItem “MEDAN-SURABAYA”

Combo1.AddItem “LOMBOK-SURABAYA”

Combo1.AddItem “SOLO-SURABAYA”

Combo1.AddItem “LAMPUNG-JAKARTA”

Combo1.AddItem “JAKARTA-LAMPUNG”

 

cboR.AddItem “SURABAYA-JAKARTA”

cboR.AddItem “SURABAYA-DENPASAR”

cboR.AddItem “SURABAYA-BALIKPAPAN”

cboR.AddItem “SURABAYA-MEDAN”

cboR.AddItem “SURABAYA-LOMBOK”

cboR.AddItem “SURABAYA-SOLO”

cboR.AddItem “JAKARTA-SURABAYA”

cboR.AddItem “DENPASAR–SURABAYA”

cboR.AddItem “BALIKPAPAN-SURABAYA”

cboR.AddItem “MEDAN-SURABAYA”

cboR.AddItem “LOMBOK-SURABAYA”

cboR.AddItem “SOLO-SURABAYA”

cboR.AddItem “LAMPUNG-JAKARTA”

cboR.AddItem “JAKARTA-LAMPUNG”

 

Combo2.AddItem “BISNIS”

txtharga.Text = “3000 000″

 

Combo2.AddItem “EKSEKUTIF”

txtharga.Text = “2000 000″

 

Combo2.AddItem “EKONOMI”

txtharga.Text = “1000 000″

 

 

 

Combo3.AddItem “BISNIS”

Combo3.AddItem “EKSEKUTIF”

Combo3.AddItem “EKONOMI”

End Sub

 

Private Sub txtgrid_KeyPress(KeyAscii As Integer)

Set rsmahasiswa = New ADODB.Recordset

rsmahasiswa.Open “select*from tbok where ALAMAT=’” & txtalamat.Text & “‘”, con, adOpenStatic, adLockOptimistic

 

If KeyAscii = 13 Then

With rsmahasiswa

 

If cmdedit.Caption = “update” Then

If .EOF Then

MsgBox “alamat” & txtalamat.Text & “belum ada”

txtalamat.SetFocus

Else

txtalamat.Enabled = True

txttelp.Enabled = True

txtalamat.SetFocus

Combo1.Text = !RUTE

Combo2.Text = !kelas

End If

End Sub

 

Private Sub txtkodetiket_KeyPress(KeyAscii As Integer)

Dim s As String

s = Mid(txtkodetiket.Text, 3, 3)

If s = “BSN” Then

Combo3.Text = “BISNIS”

txthargatiket.Text = “3000 000″

txtharga.Text = “3000 000″

Combo2.Text = “BISNIS”

ElseIf s = “EKS” Then

Combo3.Text = “EKSEKUTIF”

txthargatiket.Text = “2000 000″

txtharga.Text = “2000 000″

Combo2.Text = “EKSEKUTIF”

ElseIf s = “EKO” Then

Combo3.Text = “EKONOMI”

txthargatiket.Text = “1000 000″

txtharga.Text = “1000 000″

Combo2.Text = “EKONOMI”

End If

txttanggal.Text = Date & Format(“”)

 

s = Left(txtkodetiket.Text, 2)

If s = “01″ Then

cboR.Text = “SURABAYA-JAKARTA”

ElseIf s = “02″ Then

cboR.Text = “SURABAYA-DENPASAR”

ElseIf s = “03″ Then

cboR.Text = “SURABAYA-BALIKPAPAN”

ElseIf s = “04″ Then

cboR.Text = “SURABAYA-MEDAN”

ElseIf s = “05″ Then

cboR.Text = “SURABAYA-LOMBOK”

ElseIf s = “06″ Then

cboR.Text = “SURABAYA-SOLO”

ElseIf s = “07″ Then

cboR.Text = “JAKARTA-SURABAYA”

ElseIf s = “08″ Then

cboR.Text = “DENPASAR-SURABAYA”

ElseIf s = “09″ Then

cboR.Text = “DENPASAR-SURABAYA”

ElseIf s = “10″ Then

cboR.Text = “BALIKPAPAN-SURABAYA”

ElseIf s = “11″ Then

cboR.Text = “MEDAN-SURABAYA”

ElseIf s = “12″ Then

cboR.Text = “LOMBOK-SURABAYA”

ElseIf s = “13″ Then

cboR.Text = “SOLO-SURABAYA”

ElseIf s = “14″ Then

cboR.Text = “LAMPUNG-JAKARTA”

ElseIf s = “15″ Then

cboR.Text = “JAKARTA-LAMPUNG”

End If

 

If s = “01″ Then

Combo1.Text = “SURABAYA-JAKARTA”

ElseIf s = “02″ Then

Combo1.Text = “SURABAYA-DENPASAR”

ElseIf s = “03″ Then

Combo1.Text = “SURABAYA-BALIKPAPAN”

ElseIf s = “04″ Then

Combo1.Text = “SURABAYA-MEDAN”

ElseIf s = “05″ Then

Combo1.Text = “SURABAYA-LOMBOK”

ElseIf s = “06″ Then

Combo1.Text = “SURABAYA-SOLO”

ElseIf s = “07″ Then

Combo1.Text = “JAKARTA-SURABAYA”

ElseIf s = “08″ Then

Combo1.Text = “DENPASAR-SURABAYA”

ElseIf s = “09″ Then

Combo1.Text = “DENPASAR-SURABAYA”

ElseIf s = “10″ Then

Combo1.Text = “BALIKPAPAN-SURABAYA”

ElseIf s = “11″ Then

Combo1.Text = “MEDAN-SURABAYA”

ElseIf s = “12″ Then

Combo1.Text = “LOMBOK-SURABAYA”

ElseIf s = “13″ Then

Combo1.Text = “SOLO-SURABAYA”

ElseIf s = “14″ Then

Combo1.Text = “LAMPUNG-JAKARTA”

ElseIf s = “15″ Then

Combo1.Text = “JAKARTA-LAMPUNG”

End If

 

s = Left(txtkodetiket.Text, 2)

txttiket.Text = s

 

s = Right(txtkodetiket.Text, 3)

txtnotransaksi.Text = s

End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtalamat.SetFocus

End If

End Sub

Private Sub txtalamat_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttelp.SetFocus

End If

End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: