Académique Documents
Professionnel Documents
Culture Documents
CODE
MAIN FORM
sqlcmd = "insert into designation38 values (" & des_id & ", '" & Text3.Text & "','" & Combo2.Text & "','"
& Combo1.Text & "')"
MsgBox sqlcmd
cn.Execute sqlcmd
MsgBox "Record Successfully Added!!"
Text3.Text = ""
Call DesgMaster_Click
Exit Sub
errdesc:
dept_id = MsgBox(Err.Description, vbCritical)
End Sub
sqlcmd = "insert into items38 values (" & item_id & ",'" & Text6.Text & "','" & Combo4.Text & "','" &
Text7.Text & "'," & Text8.Text & "," & Text8.Text & ")"
MsgBox sqlcmd
cn.Execute sqlcmd
MsgBox "Record Successfully Added!!"
Text6.Text = ""
Combo4.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Call StoreMaster_Click
Exit Sub
errdesc:
item_id = MsgBox(Err.Description, vbCritical)
End Sub
'For ComboBox 1
Set r = New ADODB.Recordset
sqlcmd = "select name from department38"
r.Open sqlcmd, cn, adOpenStatic, adLockOptimistic
Combo1.Clear
If r.EOF And r.BOF Then
MsgBox "No Department Found!"
Else
r.MoveFirst
For i = 1 To r.RecordCount
Combo1.AddItem r.Fields(0).Value
r.MoveNext
Next
End If
r.Close
'For ComboBox 2
Set r = New ADODB.Recordset
sqlcmd = "select name from job_type38"
r.Open sqlcmd, cn, adOpenStatic, adLockOptimistic
Combo2.Clear
If r.EOF And r.BOF Then
MsgBox "No Job Type Found!"
Else
r.MoveFirst
For i = 1 To r.RecordCount
Combo2.AddItem r.Fields(0).Value
r.MoveNext
Next
End If
r.Close
End Sub
sqlcmd = "insert into employee38 values (" & emp_id & ", '" & Combo1.Text & "','" & Text1.Text & "','" &
Text2.Text & "','" & Text3.Text & "','" & Combo2.Text & "','" & Combo8.Text & "-" & Combo9.Text & "-"
& Combo10.Text & "','" & Combo3.Text & "','" & Combo4.Text & "'," & Text4.Text & ",'" & Text5.Text &
"','" & Text6.Text & "'," & Text7.Text & "," & Text8.Text & "," & Text9.Text & ",'" & Text10.Text & "'," &
Text11.Text & "," & des_id & "," & Text20.Text & "," & Text20.Text & ",'" & Combo13.Text & "-" &
Combo12.Text & "-" & Combo11.Text & "',NULL,1,1,123456)"
MsgBox sqlcmd
cn.Execute sqlcmd
MsgBox "Record Successfully Added!!"
Call clear_form
Exit Sub
errdesc:
des_id = MsgBox(Err.Description, vbCritical)
End Sub
Private Sub Combo7_DropDown()
Dim i As Integer
Dim r As ADODB.Recordset
Set r = New ADODB.Recordset
Combo7.Clear
If r.EOF And r.BOF Then
MsgBox "No Designation Found!"
Else
r.MoveFirst
For i = 0 To r.RecordCount - 1
Combo7.AddItem r.Fields(0).Value
r.MoveNext
Next i
End If
r.Close
End Sub
'For ComboBox 5
Set r = New ADODB.Recordset
sqlcmd = "select name from job_type38"
r.Open sqlcmd, cn, adOpenStatic, adLockOptimistic
Combo5.Clear
If r.EOF And r.BOF Then
MsgBox "No Job Type Found!"
Else
r.MoveFirst
For i = 1 To r.RecordCount
Combo5.AddItem r.Fields(0).Value
r.MoveNext
Next
End If
r.Close
Else
Call clear_form
Frame7.Visible = False
Add.Enabled = False
View.Enabled = False
del.Enabled = False
Set r = New ADODB.Recordset
sqlcmd = "select
EMP_ID,TITLE,F_NAME,M_NAME,L_NAME,SEX,DOB,MARRIED,BLOOD_GRP,H_NO,STREET,CI
TY,PIN_CODE,PHONE,MOBILE,E_MAIL,FAX,DESIG_ID,SALARY,REDUCED_SAL,DOC,CALC_D
ATE,PERMISSION,STATUS from employee38 where emp_id = " & CInt(Set_Emp_reg)
r.Open sqlcmd, cn, adOpenStatic, adLockOptimistic
If r.EOF And r.BOF Then
MsgBox "No Such Employee Exists!"
Else
Label24.Caption = r.Fields(0).Value
Combo1.Text = r.Fields(1).Value
Text1.Text = r.Fields(2).Value
Text2.Text = r.Fields(3).Value
Text3.Text = r.Fields(4).Value
Combo2.Text = r.Fields(5).Value
Label29.Caption = r.Fields(6).Value
Combo3.Text = r.Fields(7).Value
Combo4.Text = r.Fields(8).Value
Text4.Text = r.Fields(9).Value
Text5.Text = r.Fields(10).Value
Text6.Text = r.Fields(11).Value
Text7.Text = r.Fields(12).Value
Text8.Text = r.Fields(13).Value
Text9.Text = r.Fields(14).Value
Text10.Text = r.Fields(15).Value
Text11.Text = r.Fields(16).Value
Text20.Text = r.Fields(18).Value
Label27.Caption = r.Fields(19).Value
Label30.Caption = r.Fields(20).Value
End If
End If
Exit Sub
errdesc:
i = MsgBox(Err.Description, vbCritical)
End Sub
If MsgBox("Are you Sure you want to update Employee '" & a & "' ?", vbOKCancel, "Delete?") = vbOK
Then
sqlcmd = "update employee38 set TITLE ='" & Combo1.Text & "',F_NAME = '" & Text1.Text &
"',M_NAME ='" & Text2.Text & "',L_NAME='" & Text3.Text & "',SEX='" & Combo2.Text & "',DOB='"
& Combo8.Text & "-" & Combo9.Text & "-" & Combo10.Text & "',MARRIED='" & Combo3.Text &
"',BLOOD_GRP='" & Combo4.Text & "',H_NO=" & Text4.Text & ",STREET='" & Text5.Text &
"',CITY='" & Text6.Text & "',PIN_CODE=" & Text7.Text & ",PHONE=" & Text8.Text & ",MOBILE=" &
Text9.Text & ",E_MAIL='" & Text10.Text & "',FAX=" & Text11.Text & ",DESIG_ID=" & des_id &
",SALARY=" & Text20.Text & ",DOC='" & Combo13.Text & "-" & Combo12.Text & "-" &
Combo11.Text & "' where emp_id = " & CInt(i)
MsgBox sqlcmd
cn.Execute sqlcmd
End If
MsgBox ("Employee Successfully Updated")
If Set_Emp_reg = 0 Then
Call clear_form
Else
Call Form_Load
End If
Exit Sub
errdesc:
i = MsgBox(Err.Description, vbCritical)
End Sub
Text20.Text = r.Fields(18).Value
Label27.Caption = r.Fields(19).Value
Label30.Caption = r.Fields(20).Value
If (r.Fields(22).Value = 1) Then
Option1.Value = True
ElseIf (r.Fields(22).Value = 2) Then
Option2.Value = True
Else
Option3.Value = True
End If
End If
r.Close
Exit Sub
errdesc:
i = MsgBox(Err.Description, vbCritical)
End Sub
End Sub
RECEPTION FORM
Option Explicit
Dim e As Integer
Dim sqlcmd As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
End Sub
End If
r.Close
Set r = New ADODB.Recordset
sqlcmd = "select * from rooms38 where pat_id = " & CInt(i)
r.Open sqlcmd, cn, adOpenStatic, adLockOptimistic
If r.EOF And r.BOF Then
Label26.Caption = "The Patient Is Not Admitted."
Command3.Caption = "Allocate Bed"
Else
Label26.Caption = "The Patient Is Admitted in : " & r.Fields(2).Value & " Numbered : " &
Str(r.Fields(1).Value)
Command3.Caption = "Deallocate Bed"
End If
r.Close
Exit Sub
errdesc:
i = MsgBox(Err.Description, vbCritical)
End Sub
VIEW APPOINTMENT FORM
Dim k As ADODB.Recordset
Dim cn As ADODB.Connection
da = Format(DTPicker1.Value, "mm/dd/yy")
dn = Format(Now, "mm/dd/yy")
If Text1.Text = "" Then
MsgBox ("Please enter Doctor's Employee ID!!")
Exit Sub
End If
If Text2.Text = "" Then
MsgBox ("Please enter Patient's ID!!")
Exit Sub
End If
If da < dn Then
MsgBox ("Please enter a valid appiontment date!!")
Exit Sub
End If
sqlcmd = "insert into appt38 values (" & Text1.Text & "," & Text2.Text & ", to_date('" & da &
"','mm/dd/yy'),'" & Text3.Text & "',NULL)"
MsgBox sqlcmd
cn.Execute sqlcmd
MsgBox "Appointment Successfully Added!!"
Text1.Text = ""
If (pat = 0) Then
Text2.Text = ""
End If
Text3.Text = ""
Call refresh_grid2
Exit Sub
errdesc:
i = MsgBox(Err.Description, vbCritical)
End Sub