Hastane Veri Tabanı Uygulaması
HASTANE VERİ TABANI
Veri tabanı üzerinde Data1 (hastane-kimlik) ve Data2 (hastane-vizite) nesneleri "visible.false" olarak bulunmaktadır.
(General Declaration)
Public son1 As Integer
Dim son2 As Integer
Public sayi As Integer
Sub ilkform()
cmdileri.Visible = True
cmdgeri.Visible = True
cmdbas.Visible = True
cmdson.Visible = True
cmdekle.Visible = True
cmdrapor.Visible = True
cmdguncelle.Visible = True
cmdbul.Visible = True
cmdcikis.Visible = True
cmdiptal.Visible = False
End Sub
Public Sub goster()
txtad.Text = Data1.Recordset("ad")
txtsoyad.Text = Data1.Recordset("soyad")
txthastakod.Text = Data1.Recordset("hastakod")
Data2.Recordset.MoveFirst
liste(0).Clear
liste(1).Clear
liste(2).Clear
endx = 0
Do While endx = 0
Do While Not Data2.Recordset.EOF
If Data1.Recordset("hastakod") <> Data2.Recordset("hastakod") Then
Data2.Recordset.MoveNext
Else
endx = 1
varx = Data2.Recordset("hastakod")
vary = Data2.Recordset("hastakod")
Do While varx <> 0
Do While vary = varx
liste(0).AddItem (Data2.Recordset("protokolno"))
liste(1).AddItem (Data2.Recordset("tarih"))
liste(2).AddItem (Data2.Recordset("tani"))
Data2.Recordset.MoveNext
If Data2.Recordset.EOF = True Then
varx = 0
vary = 1
Else
vary = Data2.Recordset("hastakod")
End If
Loop
varx = 0
Loop
End If
Loop
Loop
End Sub
Sub ekledugkaldir()
cmdileri.Visible = False
cmdgeri.Visible = False
cmdbas.Visible = False
cmdson.Visible = False
cmdekle.Visible = False
cmdrapor.Visible = False
cmdguncelle.Visible = False
cmdbul.Visible = False
cmdcikis.Visible = False
cmdiptal.Visible = True
End Sub
Private Sub bul_Click()
Data1.Recordset.MoveFirst
sayi = 1
endx = 0
Do While endx = 0
If Data1.Recordset("hastakod") <> bul.Text Then
Data1.Recordset.MoveNext
sayi = sayi + 1
Else
endx = 1
goster
End If
Loop
End Sub
Private Sub cmdbas_Click()
Data1.Recordset.MoveFirst
goster
sayi = 1
End Sub
Private Sub cmdbul_Click()
soyadx = txtsoyad.Text
bulx = 0
bul.Clear
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
If Data1.Recordset("soyad") = soyadx Then
bul.AddItem (Data1.Recordset("hastakod"))
Data1.Recordset.MoveNext
bulx = 1
Else
Data1.Recordset.MoveNext
End If
Loop
If bulx = 0 Then
MsgBox ("bulamadim.")
Else
bul.Text = bul.List(0)
bul.Visible = True
txtbul.Visible = True
txtbul.Text = "soyad =" + soyadx
End If
End Sub
Private Sub cmdcikis_Click()
End
End Sub
Private Sub cmddegtamam_Click()
Data1.Recordset.Edit
Data1.Recordset("Ad") = txtad.Text
Data1.Recordset("Soyad") = txtsoyad.Text
Data1.Recordset.Update
Data1.Refresh
cmddegtamam.Visible = False
Data1.Recordset.Move (sayi - 1)
ilkform
goster
End Sub
Public Sub cmdekle_Click()
Ekle.Show
Hastane.Hide
son1 = son1
End Sub
Private Sub cmdgeri_Click()
If sayi <> 1 Then
Data1.Recordset.MovePrevious
goster
sayi = sayi - 1
Else
MsgBox ("Kayit basina gelindi!")
End If
End Sub
Private Sub cmdguncelle_Click()
ekledugkaldir
cmddegtamam.Visible = True
End Sub
Private Sub cmdileri_Click()
If sayi <> son1 Then
Data1.Recordset.MoveNext
goster
sayi = sayi + 1
Else
MsgBox ("Kayit sonuna gelindi!")
End If
End Sub
Private Sub cmdiptal_Click()
goster
cmdekletamam.Visible = False
cmddegtamam.Visible = False
ilkform
goster
End Sub
Private Sub cmdrapor_Click()
DataReport1.Show
End Sub
Private Sub cmdson_Click()
Data1.Recordset.MoveLast
goster
sayi = son1
End Sub
Private Sub Form_Load()
Data1.Refresh
Data2.Refresh
Data1.Recordset.MoveLast
son1 = Data1.Recordset.RecordCount
Data2.Recordset.MoveLast
son2 = Data1.Recordset.RecordCount
Data1.Recordset.MoveFirst
sayi = 1
goster
End Sub
EKLE FORMU
Public Sub cmdekletamam_Click()
Hastane.Data1.Recordset.AddNew
Hastane.Data1.Recordset("Ad") = txtad.Text
Hastane.Data1.Recordset("Soyad") = txtsoyad.Text
Hastane.son1 = Hastane.son1 + 1
Hastane.Data1.Recordset("Hastakod") = Hastane.son1
Hastane.Data2.Recordset.AddNew
Hastane.Data2.Recordset("Hastakod") = Hastane.son1
Hastane.Data2.Recordset("protokolno") = txtprot.Text
Hastane.Data2.Recordset("tarih") = txttarih.Text
Hastane.Data2.Recordset("tani") = txttani.Text
Hastane.Data1.Recordset.Update
Hastane.Data2.Recordset.Update
Hastane.Data1.Refresh
Hastane.Data2.Refresh
Hastane.goster
Hastane.sayi = 1
Hastane.Show
Ekle.Hide
End Sub
Private Sub cmdiptal_Click()
Hastane.Show
Ekle.Hide
End Sub
Private Sub Form_Load()
txtad.Text = ""
txtsoyad.Text = ""
txtprot.Text = ""
txttani.Text = ""
txttarih.Text = ""
End Sub