0% found this document useful (0 votes)
76 views

Coding: Menu Form

The document contains coding for various forms used in a hospital management system. It includes code for menu forms, login forms, patient information forms, patient record forms, patient report forms, and patient discharge forms. The code handles form loading, displaying data, adding, updating, deleting records, and navigating between records using buttons.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Coding: Menu Form

The document contains coding for various forms used in a hospital management system. It includes code for menu forms, login forms, patient information forms, patient record forms, patient report forms, and patient discharge forms. The code handles form loading, displaying data, adding, updating, deleting records, and navigating between records using buttons.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 104

Coding

Menu Form

Private Sub ATIENT_ADMIT1_Click()


Form3.Show
End Sub

Private Sub BI_Click()


Form20.Show
End Sub

Private Sub BILL_INFO1_Click()


Form7.Show

End Sub

Private Sub CITY1_Click()


Form8.Show
End Sub

Private Sub DI_Click()


Form9.Show
End Sub

Private Sub DISCHARGE1_Click()


Form6.Show
End Sub
Private Sub DS1_Click()
Form11.Show
End Sub

Private Sub EMP_Click()


Form16.Show
End Sub

Private Sub EXIT1_Click()


End

End Sub

Private Sub Form_Load()

End Sub

Private Sub INFORMATION_Click()


Form2.Show
End Sub

Private Sub LOGIN_MANAGER1_Click()


Form10.Show
End Sub

Private Sub NH1_Click()


Form15.Show
End Sub

Private Sub OPERATION1_Click()


Form22.Show
End Sub

Private Sub P_INFO_Click()


Form18.Show
End Sub

Private Sub PR_Click()


Form5.Show
End Sub

Private Sub PR1_Click()


Form4.Show
End Sub

Private Sub ROOM_Click()


Form12.Show
End Sub

Private Sub ROOM1_Click()


Form21.Show
End Sub

Private Sub SERVECE_Click()


Form14.Show
End Sub

Private Sub WARD2_Click()


Form17.Show
End Sub

Private Sub WM1_Click()


Form13.Show
End Sub

Private Sub XYZ_Click()


Form19.Show
End Sub
Login Form

‘General Section
Dim db As Connection
Dim rs As Recordset
Dim X As Integer

Coding for OK Button


Private Sub Command1_Click()
If X < 2 Then
If Text1.Text = rs!user_id And Text2.Text = rs!Password Then
Load Form2
Form2.Show
Unload Form1
Else
MsgBox "invalid password,try again"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
X=X+1
Else
End
End If
End Sub

‘Coding for Form Load

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider = msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from login", db, adOpenStatic, adLockOptimistic
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Command1_Click
End If

End Sub
PATIENT INFORMATION

‘Genral
Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

ADD BUTTON
Private Sub Command1_Click()
X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!p_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Option1.Value = False
Option2.Value = False
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

UPDATE BUTTON
Private Sub Command2_Click()
If X = 1 Then
rs!p_code = Text1.Text
rs!p_f_name = Text2.Text
rs!p_l_name = Text3.Text
rs!d_o_birth = Val(Text4.Text)
rs!c_o = Text5.Text
If Option1.Value = True Then
rs!sex = "M"
Else
rs!sex = "F"
End If

rs!r_name = Text7.Text
rs!addr = Text8.Text
rs!c_code = Text9.Text

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0
End Sub

DELETE BUTTON
Private Sub Command3_Click()
rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Option1.Value = False
Option2.Value = False
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select
p_code,p_f_name,p_l_name,d_o_birth,sex,c_o,r_name,addr,c_code from
patient_info", db, adOpenStatic, adLockOptimistic
End Sub

EDIT/SAVE BUTTON
Private Sub Command4_Click()

rs!p_code = Text1.Text
rs!p_f_name = Text2.Text
rs!p_l_name = Text3.Text
rs!d_o_birth = Val(Text4.Text)
rs!c_o = Text5.Text
If Option1.Value = True Then
rs!sex = "M"
Else
rs!sex = "F"
End If
rs!r_name = Text7.Text
rs!addr = Text8.Text
rs!c_code = Text9.Text
rs.Update
End Sub

PREVIOUS BITTON
Private Sub Command5_Click()

On Error Resume Next


If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If
End Sub

NEXT BUTTON
Private Sub Command6_Click()
On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

FIRST BUTTON
Private Sub Command7_Click()
On Error Resume Next
rs.MoveFirst
disp
End Sub

LAST BUTTON
Private Sub Command8_Click()
On Error Resume Next
rs.MoveLast
disp
End Sub

EXIT BUTTON
Private Sub Command9_Click()

Unload Me
End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select
p_code,p_f_name,p_l_name,d_o_birth,sex,c_o,r_name,addr,c_code from
patient_info", db, adOpenStatic, adLockOptimistic
rs1.Open "select p_code from patient_info", db, adOpenStatic, adLockOptimistic
disp

End Sub

DISPLAY FUNCATION
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!p_code
Text2.Text = rs!p_f_name
Text3.Text = rs!p_l_name
Text4.Text = rs!d_o_birth
Text5.Text = rs!c_o
If rs!sex = "M" Or rs!sex = "m" Then
Option1.Value = True
Else
Option2.Value = True
End If
Text7.Text = rs!r_name
Text8.Text = rs!addr
Text9.Text = rs!c_code

End If
End Sub
PATIENT RECORD

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!p_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text2.SetFocus
rs.AddNew
End If
End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!p_code = Val(Text1.Text)
rs!admit_date = Text2.Text
rs!day_no = Val(Text3.Text)
rs!fees = Val(Text4.Text)
rs!ser_code = Val(Text5.Text)

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0
End Sub

Private Sub Command3_Click()

rs!p_code = Val(Text1.Text)
rs!admit_date = Text2.Text
rs!day_no = Val(Text3.Text)
rs!fees = Val(Text4.Text)
rs!ser_code = Val(Text5.Text)
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select p_code,admit_date,day_no,fees,ser_code from patient_rec", db,
adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst
End If
End If
End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNextdisp
If rs.EOF = True Then
rs.MoveLast
End If
End If
End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp
End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp
End Sub

Private Sub Command9_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select p_code,admit_date,day_no,fees,ser_code from patient_rec", db,
adOpenStatic, adLockOptimistic
rs1.Open "select p_code from patient_rec", db, adOpenStatic, adLockOptimistic
disp
End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!p_code
Text2.Text = rs!admit_date
Text3.Text = rs!day_no
Text4.Text = rs!fees
Text5.Text = rs!ser_code
End If

End Sub
PATIENT REPORT

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!admit_no) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text2.SetFocus
rs.AddNew
End If
End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!admit_no = Val(Text1.Text)
rs!disch_date = Text2.Text
rs!complaints = Text3.Text
rs!tretment = Text4.Text
rs!condition = Text5.Text
rs!remark = Text6.Text
rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!admit_no = Text1.Text
rs!disch_date = Text2.Text
rs!complaints = Text3.Text
rs!tretment = Text4.Text
rs!condition = Text5.Text

rs!remark = Text6.Text

rs.Update
End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select admit_no,disch_date,complaints,tretment,condition,remark from
patient_report", db, adOpenStatic, adLockOptimistic
End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst
End If
End If
End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast
End If
End If
End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp
End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp
End Sub

Private Sub Command9_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select admit_no,disch_date,complaints,tretment,condition,remark from
patient_report", db, adOpenStatic, adLockOptimistic
rs1.Open "select admit_no from patient_report", db, adOpenStatic,
adLockOptimistic
disp
End Sub

Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!admit_no
Text2.Text = rs!disch_date
Text3.Text = rs!complaints
Text4.Text = rs!tretment
Text5.Text = rs!condition
Text6.Text = rs!remark

End If

End Sub
PATIENT DISCHARGE

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!bill_no) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text2.SetFocus
rs.AddNew

End If
End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!bill_no = Val(Text1.Text)
rs!sv_code = Val(Text2.Text)
rs!no_o_days = Val(Text3.Text)
rs!charge = Val(Text4.Text)
rs!rec_no = Val(Text5.Text)
rs.Update
Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!bill_no = Val(Text1.Text)
rs!sv_code = Val(Text2.Text)
rs!no_o_days = Val(Text3.Text)
rs!charge = Val(Text4.Text)
rs!rec_no = Val(Text5.Text)
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select bill_no,sv_code,no_o_days,charge,rec_no from disch_bill", db,
adOpenStatic, adLockOptimistic
End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub
Private Sub Command7_Click()
On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select bill_no,sv_code,no_o_days,charge,rec_no from disch_bill", db,
adOpenStatic, adLockOptimistic
rs1.Open "select bill_no from disch_bill", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!bill_no
Text2.Text = rs!sv_code
Text3.Text = rs!no_o_days
Text4.Text = rs!charge
Text5.Text = rs!rec_no
End If
End Sub
PATIENT DATE

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!bill_no) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!bill_no = Val(Text1.Text)
rs!sv_code = Val(Text2.Text)
rs!no_o_days = Val(Text3.Text)
rs!charge = Val(Text4.Text)
rs!rec_no = Val(Text5.Text)
rs.Update
Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!bill_no = Val(Text1.Text)
rs!sv_code = Val(Text2.Text)
rs!no_o_days = Val(Text3.Text)
rs!charge = Val(Text4.Text)
rs!rec_no = Val(Text5.Text)
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select bill_no,sv_code,no_o_days,charge,rec_no from disch_bill", db,
adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If
End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select bill_no,sv_code,no_o_days,charge,rec_no from disch_bill", db,
adOpenStatic, adLockOptimistic
rs1.Open "select bill_no from disch_bill", db, adOpenStatic, adLockOptimistic
disp
End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!bill_no
Text2.Text = rs!sv_code
Text3.Text = rs!no_o_days
Text4.Text = rs!charge
Text5.Text = rs!rec_no
End If
End Sub
BILL INFORMATION

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer
Dim sum As Integer, sum1 As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!bill_no) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text2.SetFocus
rs.AddNew
End If
End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!bill_no = Val(Text1.Text)
rs!admit_code = Val(Text2.Text)
rs!disch_date = Text3.Text
rs!total = Val(Text4.Text)
rs!adv = Val(Text5.Text)
rs!discount = Val(Text6.Text)
rs!net_amt = Val(Text7.Text)

rs.Update

Else
MsgBox "first add record and then update"
End If

End Sub

Private Sub Command3_Click()


rs!bill_no = Val(Text1.Text)
rs!admit_code = Val(Text2.Text)
rs!disch_date = Text3.Text
rs!total = Val(Text4.Text)
rs!adv = Val(Text5.Text)

rs!discount = Val(Text6.Text)
rs!net_amt = Val(Text7.Text)
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select bill_no,admit_code,disch_date,total,adv,discount,net_amt from
bill_info", db, adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If
End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub
Private Sub Command9_Click()
Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select bill_no,admit_code,disch_date,total,adv,discount,net_amt from
bill_info", db, adOpenStatic, adLockOptimistic
rs1.Open "select bill_no from bill_info", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!bill_no
Text2.Text = rs!admit_code
Text3.Text = rs!disch_date
Text4.Text = rs!total
Text5.Text = rs!adv
Text6.Text = rs!discount
Text7.Text = rs!net_amt

End If

End Sub
Private Sub Text7_GotFocus()

Text7.Text = Val(Text4.Text) - (Val(Text5.Text) + Val(Text6.Text))

End Sub
CITY

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!c_code) + 1
Else
Text1.Text = 1
End If
Text2.Text = " "
Text2.SetFocus
rs.AddNew
End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!c_code = Val(Text1.Text)
rs!c_name = Text2.Text
rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!c_code = Val(Text1.Text)
rs!c_name = Text2.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select c_code,c_name from city", db, adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub
Private Sub Command8_Click()
On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select c_code,c_name from city", db, adOpenStatic, adLockOptimistic
rs1.Open "select c_code from city", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!c_code
Text2.Text = rs!c_name

End If

End Sub
DOCTOR INFORMATION

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!d_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Option1.Value = False
Option2.Value = False
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
Text14.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!d_code = Val(Text1.Text)
rs!d_f_name = Text2.Text
rs!d_l_name = Text3.Text
rs!d_o_birth = Text4.Text

If Option1.Value = True Then


rs!sex = "M"
Else
rs!sex = "F"
End If

rs!phone = Text6.Text
rs!mobile = Text7.Text
rs!addr1 = Text8.Text
rs!addr2 = Text9.Text
rs!c_code = Text10.Text
rs!s_code = Text11.Text
rs!degree = Text12.Text
rs!fees = Text13.Text
rs!next_a_date = Text14.Text
rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!d_code = Val(Text1.Text)
rs!d_f_name = Text2.Text
rs!d_l_name = Text3.Text
rs!d_o_birth = Text4.Text

If Option1.Value = True Then


rs!sex = "M"
Else
rs!sex = "F"
End If

rs!phone = Text6.Text
rs!mobile = Text7.Text
rs!addr1 = Text8.Text
rs!addr2 = Text9.Text
rs!c_code = Text10.Text
rs!s_code = Text11.Text
rs!degree = Text12.Text
rs!fees = Text13.Text
rs!next_a_date = Text14.Text
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Option1.Value = False
Option2.Value = False
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
Text14.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select
d_code,d_f_name,d_l_name,d_o_birth,sex,phone,mobile,addr1,addr2,c_code,s_
code,degree,fees,next_a_date from doctor_info", db, adOpenStatic,
adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp
End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select
d_code,d_f_name,d_l_name,d_o_birth,sex,phone,mobile,addr1,addr2,c_code,s_
code,degree,fees,next_a_date from doctor_info", db, adOpenStatic,
adLockOptimistic
rs1.Open "select d_code from doctor_info", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!d_code
Text2.Text = rs!d_f_name
Text3.Text = rs!d_l_name
Text4.Text = rs!d_o_birth

If rs!sex = "M" Or rs!sex = "m" Then


Option1.Value = True
Else
Option2.Value = True
End If
Text6.Text = rs!phone
Text7.Text = rs!mobile
Text8.Text = rs!addr1
Text9.Text = rs!addr2
Text10.Text = rs!c_code
Text11.Text = rs!s_code
Text12.Text = rs!degree
Text13.Text = rs!fees
Text14.Text = rs!next_a_date

End If

End Sub
LOGIN MASTER

Dim db As Connection
Dim rs As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

Text1.Text = " "


Text2.Text = " "
Text1.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!user_id = Text1.Text
rs!Password = Text2.Text

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!user_id = Text1.Text
rs!Password = Text2.Text
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub
Private Sub Command6_Click()
On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select user_id,password from login", db, adOpenStatic,
adLockOptimistic
disp

End Sub

Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!user_id
Text2.Text = rs!Password

End If

End Sub
DOCTOR SPECIALIST

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!s_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!s_code = Val(Text1.Text)
rs!spl_name = Text2.Text
rs!d_code = Val(Text3.Text)

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!s_code = Val(Text1.Text)
rs!spl_name = Text2.Text
rs!d_code = Val(Text3.Text)

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select s_code,d_code,spl_name from doctor_spl", db, adOpenStatic,
adLockOptimistic
End Sub

Private Sub Command5_Click()

On Error Resume Next


If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select s_code,d_code,spl_name from doctor_spl", db, adOpenStatic,
adLockOptimistic
rs1.Open "select s_code from doctor_spl", db, adOpenStatic, adLockOptimistic
disp

End Sub

Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!s_code
Text2.Text = rs!spl_name
Text3.Text = rs!d_code

End If

End Sub
ROOM

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!bed_no) + 1
Else
Text1.Text = 1
End If

Text2.Text = ""
Combo2.Text = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Option6.Value = False
Text4.Text = ""
Text5.Text = ""

Combo1.Text = ""
Text2.SetFocus
rs.AddNew
End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!bed_no = Text1.Text
rs!room_code = Val(Text2.Text)
rs!room_type = Combo2.Text
If Option1.Value = True Then
rs!tv = "Y"
Else
rs!tv = "N"
End If
If Option3.Value = True Then
rs!ac = "Y"
Else
rs!ac = "N"
End If
If Option5.Value = True Then
rs!Status = "w"
Else
rs!Status = "n"
End If

rs!charge = Text4.Text
rs!ward_code = Text5.Text
rs!dept = Combo1.Text
rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!bed_no = Text1.Text
rs!room_code = Text2.Text
rs!room_type = Combo2.Text

If Option1.Value = True Then


rs!tv = "Y"
Else
rs!tv = "N"
End If
If Option3.Value = True Then
rs!ac = "Y"
Else
rs!ac = "N"
End If
If Option5.Value = True Then
rs!Status = "w"
Else
rs!Status = "n"
End If
rs!charge = Text4.Text
rs!ward_code = Text5.Text
rs!dept = Combo1.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = ""
Text2.Text = ""
Combo2.Text = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Option5.Value = False
Option6.Value = False
Text4.Text = ""
Text5.Text = ""
Combo1.Text = ""

Set rs = New ADODB.Recordset


rs.Open "select
bed_no,room_code,room_type,charge,tv,ac,status,ward_code,dept from room
order by bed_no asc", db, adOpenStatic, adLockOptimistic

End Sub
Private Sub Command5_Click()
On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select
bed_no,room_code,room_type,charge,tv,ac,status,ward_code,dept from room
order by bed_no asc", db, adOpenStatic, adLockOptimistic
rs1.Open "select bed_no from room", db, adOpenStatic, adLockOptimistic
disp

Combo1.AddItem "CARDIOLOGY"
Combo1.AddItem "NEUROLOGY"
Combo1.AddItem "Psychiatry"
Combo1.AddItem "ORTOAEDICS"
Combo1.AddItem "OBSTETRICS"
Combo2.AddItem "Special"
Combo2.AddItem "Normal"

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!bed_no
Text2.Text = rs!room_code
Combo2.Text = rs!room_type
If rs!tv = "Y" Or rs!tv = "y" Then
Option1.Value = True
Else
Option2.Value = True
End If
If rs!ac = "Y" Or rs!ac = "y" Then
Option3.Value = True
Else
Option4.Value = True
End If
If rs!Status = "W" Or rs!Status = "w" Then
Option5.Value = True
Else
Option6.Value = True
End If
Text4.Text = rs!charge
Text5.Text = rs!ward_code
Combo1.Text = rs!dept

End If

End Sub
WARD MASTER

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!ward_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!ward_code = Val(Text1.Text)
rs!ward_name = Text2.Text
rs!incharge = Text3.Text
rs.Update
Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!ward_code = Text1.Text
rs!ward_name = Text2.Text
rs!incharge = Text3.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select ward_code,ward_name,incharge from ward_master", db,
adOpenStatic, adLockOptimistic

End Sub
Private Sub Command5_Click()
On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp
End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select ward_code,ward_name,incharge from ward_master", db,
adOpenStatic, adLockOptimistic
rs1.Open "select ward_code from ward_master", db, adOpenStatic,
adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!ward_code
Text2.Text = rs!ward_name
Text3.Text = rs!incharge

End If

End Sub
SERVICES

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!sv_code) + 1
Else
Text1.Text = 1
End If

Text2.Text = " "


Option1.Value = False
Option2.Value = False

Text3.Text = " "


Text4.Text = " "
Text2.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!sv_code = Text1.Text
rs!sv_name = Text2.Text
If Option1.Value = True Then
rs!Status = "G"
Else
rs!Status = "N"
End If

rs!incharge = Text3.Text
rs!fees = Text4.Text

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!sv_code = Text1.Text
rs!sv_name = Text2.Text
If Option1.Value = True Then
rs!Status = "G"
Else
rs!Status = "N"
End If
rs!incharge = Text3.Text
rs!fees = Text4.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Option1.Value = False
Option2.Value = False
Text3.Text = " "
Text4.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select sv_code,sv_name,status,incharge,fees from service", db,
adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp
End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select sv_code,sv_name,status,incharge,fees from service", db,
adOpenStatic, adLockOptimistic
rs1.Open "select sv_code from service", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!sv_code
Text2.Text = rs!sv_name
If rs!Status = "G" Or rs!Status = "g" Then
Option1.Value = True
Else
Option2.Value = True
End If

Text3.Text = rs!incharge
Text4.Text = rs!fees
End If

End Sub
NURSING HOME

Dim db As Connection
Dim rs As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "

Text1.SetFocus
rs.AddNew

End If

End Sub
Private Sub Command2_Click()
If X = 1 Then
rs!Name = Text1.Text
rs!addr1 = Text2.Text
rs!addr2 = Text3.Text
rs!city = Text4.Text
rs!pin = Text5.Text

rs!phone1 = Text6.Text
rs!phone2 = Text7.Text
rs!am_phone = Text8.Text
rs!mobile = Val(Text9.Text)

rs!head = Text10.Text
rs!visiting_date = Text11.Text
rs!remark = Text12.Text

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!Name = Text1.Text
rs!addr1 = Text2.Text
rs!addr2 = Text3.Text
rs!city = Text4.Text
rs!pin = Text5.Text

rs!phone1 = Text6.Text
rs!phone2 = Text7.Text
rs!am_phone = Text8.Text
rs!mobile = Text9.Text

rs!head = Text10.Text
rs!visiting_date = Text11.Text
rs!remark = Text12.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select
name,addr1,addr2,city,pin,phone1,phone2,am_phone,mobile,head,visiting_date,r
emark from nursing_home", db, adOpenStatic, adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select
name,addr1,addr2,city,pin,phone1,phone2,am_phone,mobile,head,visiting_date,r
emark from nursing_home", db, adOpenStatic, adLockOptimistic

disp

End Sub

Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!Name
Text2.Text = rs!addr1
Text3.Text = rs!addr2
Text4.Text = rs!city
Text5.Text = rs!pin
Text6.Text = rs!phone1
Text7.Text = rs!phone2
Text8.Text = rs!am_phone
Text9.Text = rs!mobile
Text10.Text = rs!head
Text11.Text = rs!visiting_date
Text12.Text = rs!remark

End If

End Sub
EMPLOYEE

Dim db As Connection
Dim rs As Recordset, rs1 As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

If rs.RecordCount >= 1 Then


rs.MoveLast
Text1.Text = Val(rs!emp_code) + 1

Else
Text1.Text = 1
End If

Text2.Text = " "


Text3.Text = " "
Text4.Text = " "
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False

Text5.Text = " "


Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
Text2.SetFocus

rs.AddNew
End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!emp_code = Text1.Text
rs!emp_f_name = Text2.Text
rs!emp_l_name = Text3.Text
rs!d_o_birth = Text4.Text

If Option1.Value = True Then


rs!sex = "M"
Else
rs!sex = "F"
End If

rs!phone = Text5.Text
rs!mobile = Text6.Text
rs!addr1 = Text7.Text
rs!addr2 = Text8.Text
rs!c_code = Text9.Text
rs!s_code = Text10.Text
rs!degree = Text11.Text
rs!salary = Text12.Text
If Option3.Value = True Then
rs!Status = "G"
Else
rs!Status = "n"
End If
rs!promoter = Text13.Text
rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!emp_code = Text1.Text
rs!emp_f_name = Text2.Text
rs!emp_l_name = Text3.Text
rs!d_o_birth = Text4.Text

If Option1.Value = True Then


rs!sex = "M"
Else
rs!sex = "F"
End If
rs!phone = Text5.Text
rs!mobile = Text6.Text
rs!addr1 = Text7.Text
rs!addr2 = Text8.Text
rs!c_code = Text9.Text
rs!s_code = Text10.Text
rs!degree = Text11.Text
rs!salary = Text12.Text
If Option3.Value = True Then
rs!Status = "G"
Else
rs!Status = "n"
End If
rs!promoter = Text13.Text
rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select
emp_code,emp_f_name,emp_l_name,d_o_birth,sex,phone,mobile,addr1,addr2,c
_code,s_code,degree,salary,status,promoter from emp", db, adOpenStatic,
adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext
disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp

End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select
emp_code,emp_f_name,emp_l_name,d_o_birth,sex,phone,mobile,addr1,addr2,c
_code,s_code,degree,salary,status,promoter from emp", db, adOpenStatic,
adLockOptimistic
rs1.Open "select emp_code from emp", db, adOpenStatic, adLockOptimistic
disp

End Sub
Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!emp_code
Text2.Text = rs!emp_f_name
Text3.Text = rs!emp_l_name
Text4.Text = rs!d_o_birth

If rs!sex = "M" Or rs!sex = "m" Then


Option1.Value = True
Else
Option2.Value = True
End If
Text5.Text = rs!phone
Text6.Text = rs!mobile
Text7.Text = rs!addr1
Text8.Text = rs!addr2
Text9.Text = rs!c_code
Text10.Text = rs!s_code
Text11.Text = rs!degree
Text12.Text = rs!salary
If rs!Status = "G" Or rs!Status = "g" Then
Option3.Value = True
Else
Option4.Value = True
End If
Text13.Text = rs!promoter
End If

End Sub
WARD

Dim db As Connection
Dim rs As Recordset
Dim X As Integer

Private Sub Command1_Click()


X=1
If X = 1 Then

Text1.Text = " "


Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text1.SetFocus
rs.AddNew

End If

End Sub

Private Sub Command2_Click()


If X = 1 Then
rs!p_code = Text1.Text
rs!Test = Text2.Text
rs!charge = Text3.Text
rs!date_o_test = Text4.Text

rs.Update

Else
MsgBox "first add record and then update"
End If
X=0

End Sub

Private Sub Command3_Click()


rs!p_code = Text1.Text
rs!Test = Text2.Text
rs!charge = Text3.Text
rs!date_o_test = Text4.Text

rs.Update

End Sub

Private Sub Command4_Click()


rs.Delete
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Set rs = New ADODB.Recordset
rs.Open "select p_code,test,charge,date_o_test from ward", db, adOpenStatic,
adLockOptimistic

End Sub

Private Sub Command5_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MovePrevious
disp
If rs.BOF = True Then
rs.MoveFirst

End If
End If

End Sub

Private Sub Command6_Click()


On Error Resume Next
If rs.RecordCount >= 1 Then
rs.MoveNext

disp
If rs.EOF = True Then
rs.MoveLast

End If
End If

End Sub

Private Sub Command7_Click()


On Error Resume Next
rs.MoveFirst
disp
End Sub

Private Sub Command8_Click()


On Error Resume Next
rs.MoveLast
disp

End Sub

Private Sub Command9_Click()


Unload Me

End Sub

Private Sub Form_Load()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select p_code,test,charge,date_o_test from ward", db, adOpenStatic,
adLockOptimistic
disp
End Sub

Sub disp()
If rs.RecordCount >= 1 Then
Text1.Text = rs!p_code
Text2.Text = rs!Test
Text3.Text = rs!charge
Text4.Text = rs!date_o_test

End If

End Sub
REPORT PATIENT INFORMATION

Dim db As Connection
Dim rs As Recordset

Private Sub Command1_Click()


Unload Me
End Sub

Private Sub Command2_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from patient_info where p_code=" & Text1.Text & " ", db,
adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command3_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from patient_info", db, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command4_Click()


Form18.PrintForm
End Sub

Private Sub Form_Load()


'Command4.Style = 1
Command4.Picture = LoadPicture(App.Path + "\print.bmp")

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)


If KeyCode = 13 Then
Command2_Click
End If
End Sub
REPORT PATIENT REPORT

Dim db As Connection
Dim rs As Recordset
Private Sub Command1_Click()
Unload Me

End Sub

Private Sub Command2_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from patient_report where admit_no=" & Text1.Text & " ", db,
adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command3_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from patient_report", db, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command4_Click()


Form19.PrintForm
End Sub

Private Sub Form_Load()


'Command4.Style = 1
Command4.Picture = LoadPicture(App.Path + "\print.bmp")
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 13 Then
Command2_Click
End If

End Sub
REPORT BILL INFORMATION

Dim db As Connection
Dim rs As Recordset

Private Sub Command1_Click()


Unload Me

End Sub

Private Sub Command2_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from bill_info where bill_no=" & Text1.Text & " ", db,
adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub
Private Sub Command3_Click()
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from bill_info", db, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command4_Click()


Form20.PrintForm
End Sub
Private Sub Form_Load()
'Command4.Style = 1
Command4.Picture = LoadPicture(App.Path + "\print.bmp")

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)


If KeyCode = 13 Then
Command2_Click
End If

End Sub
REPORT ROOM

Dim db As Connection
Dim rs As Recordset

Private Sub Command1_Click()


Unload Me

End Sub

Private Sub Command2_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from room where bed_no=" & Text1.Text & " ", db,
adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command3_Click()


Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.Open "provider=msdasql;dsn=pradeep;uid=medical;pwd=college"
rs.Open "select *from room", db, adOpenStatic, adLockOptimistic
Set Adodc1.Recordset.DataSource = rs.DataSource

End Sub

Private Sub Command4_Click()


Form21.PrintForm
End Sub

Private Sub Form_Load()


'Command4.Style = 1
Command4.Picture = LoadPicture(App.Path + "\print.bmp")
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)


If KeyCode = 13 Then
Command2_Click
End If

End Sub

You might also like