Sei sulla pagina 1di 3

Option Explicit

Public rs_check_in As ADODB.Recordset


'Public rs_Kamar As ADODB.Recordset
Public rs_Tamu As ADODB.Recordset
Dim x As Control
Dim a As String
Dim isi As Boolean
Sub no()
Dim urutan As String
Dim hitung As Long
Adocheckin.RecordSource = "Select*from check_in"
Adocheckin.Refresh
If Adocheckin.Recordset.RecordCount <= 0 Then
urutan = Adocheckin.Recordset.RecordCount + 1
Text1 = "F" + Format(Date, "yymm") + Format(urutan, "000")
Else
Adocheckin.Recordset.MoveLast
urutan = Val(Right(Adocheckin.Recordset!No_Registrasi, 3)) + 1
Text1 = "P" + Format(Date, "yymm") + Format(urutan, "000")
End If
End Sub
Sub notam()
Dim urutan As String
Dim hitung As Long
Adotamu.RecordSource = "Select*from tamu"
Adotamu.Refresh
If Adotamu.Recordset.RecordCount <= 0 Then
urutan = Adotamu.Recordset.RecordCount + 1
Text1 = "C" + Format(Date, "yymm") + Format(urutan, "000")
Else
Adotamu.Recordset.MoveLast
urutan = Val(Right(Adotamu.Recordset!No_Tamu, 3)) + 1
Text3 = "N" + Format(Date, "yymm") + Format(urutan, "000")
End If
End Sub
Sub bersih()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Text = ""
End If
Next
End Sub
Sub aktif()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Enabled = True
End If
Next
cmddel.Enabled = True
cmdedit.Enabled = True
cmdsave.Enabled = True
cmdcari.Enabled = True
cmdbro.Enabled = True
dc1.Enabled = True
Adocheckin.Enabled = True
End Sub

Sub nonaktif()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Enabled = False
End If
Next
cmddel.Enabled = False
cmdedit.Enabled = False
cmdsave.Enabled = False
cmdcari.Enabled = False
cmdbro.Enabled = False
dc1.Enabled = False
Adocheckin.Enabled = False
End Sub
Private Sub cmdadd_Click()
Call aktif
Call bersih
Call no
Call notam
dc1.Text = "--Pilih--"
Text4.SetFocus
End Sub
Private Sub dc2_Change()
Adokamar.RecordSource = "select*from kamar where Kode_Kamar=" ' & dc2.text &"'"
'Adokamar.Recordset.MoveFirst
'Do While Not Adokamar.Recordset.EOF
With Adokamar.Recordset
If dc2.Text = Adokamar.Recordset!Kode_Kamar Then
Text8 = Adokamar.Recordset!Nama_Kamar
Text9 = Adokamar.Recordset!Kelas
Text10 = Adokamar.Recordset!Tarif
Text11 = Adokamar.Recordset!Fasilitas
End If
End With
'Loop
End Sub
Private Sub Form_Activate()
Call bersih
Call nonaktif
Call no
Call notam
dc1.Text = "--Pilih--"
End Sub
Private Sub Form_Load()
On Error GoTo Oraberes
Call koneksi
Set rs_check_in = New ADODB.Recordset
'Set rs_Kamar = New ADODB.Recordset
Set rs_Tamu = New ADODB.Recordset
Dim check_in As String
Dim Kamar As String
Dim Tamu As String
'Membentuk Query yang menampilkan Data
check_in = "select*from check_in"
Kamar = "select*from Kamar"

Tamu = "select*from Tamu"


'Membuka tabel
rs_check_in.CursorLocation = adUseClient
rs_check_in.Open check_in, Conn, adOpenDynamic, adLockOptimistic
'rs_Kamar.CursorLocation = adUseClient
'rs_Kamar.Open Kamar, Conn, adOpenDynamic, adLockOptimistic
rs_Tamu.CursorLocation = adUseClient
rs_Tamu.Open Tamu, Conn, adOpenDynamic, adLockOptimistic
'Menampilkan data pada DGBarang
Set Adocheckin.Recordset = rs_check_in
Set Adotamu.Recordset = rs_Tamu
'Set Adokamar.Recordset = rs_Kamar
Exit Sub
Oraberes:
MsgBox Err.Description
End Sub
Private Sub Timer1_Timer()
Text2.Text = Now
End Sub

Potrebbero piacerti anche