Next Chapter 54 Indoor Patient Registration

Indoor Patient Registration

Dim ADDMode As Boolean

Dim EditMode As Boolean

Dim EmptyTable As Boolean

Dim rst As New ADODB.Recordset

Dim Conn1 As New ADODB.Connection

Dim s As String

Dim a As String

Private Sub SetControls()

'Set Forms Control's status

'Called in Form_Load(), Navigation Buttons Click()

DTPicker2 = Date

AddCmd.Enabled = Not (ADDMode Or EditMode)

EditCmd.Enabled = Not (EmptyTable Or ADDMode Or EditMode)

SaveCmd.Enabled = (ADDMode Or EditMode)

cmdCancel.Enabled = (ADDMode Or EditMode)

DelCmd.Enabled = (ADDMode Or EditMode)

CmdExit.Enabled = Not (ADDMode Or EditMode)

CmdPreview.Enabled = (ADDMode Or EditMode)

CmdShowReport.Enabled = (ADDMode Or EditMode)

CmdReport.Enabled = (ADDMode Or EditMode)

CmdICard.Enabled = (ADDMode Or EditMode)

txtAddress.Tag = ""

Set PatientSrch.BoundTextBox = IIf(EditMode, txtRegNo, Nothing)

On Error Resume Next

txtRegNo.SetFocus

End Sub

Private Sub AddCmd_Click()

On Error GoTo ErHand

ADDMode = True

Call ClearFields

Call SetControls

'Conn1.BeginTrans

ErHand:

ErrHandler "Registration.AddCmd_Click()"

End Sub

Private Sub cmdCancel_Click()

On Error Resume Next

ADDMode = False

EditMode = False

Call ClearFields

Call SetControls

'Conn1.RollbackTrans

End Sub

Private Sub CmdExit_Click()

Unload SearchFrm

Unload registration

End Sub

Private Sub DelCmd_Click()

Dim Cancelled As Boolean

Dim SQL As String

Dim rst As New ADODB.Recordset

rst.CursorLocation = adUseClient

Conn1.BeginTrans

If Me.txtRegNo = "" Then MsgBox "Please select Patient Name from list to delete.", vbCritical, "Item is not selected": Exit Sub

If MsgBox("This will delete the selected item [" & Me.TxtTitle & " " & Me.txtfirst & " " & Me.txtmiddle & " " & txtlast & "]. Are you sure to delete it ?", vbQuestion + vbYesNo + vbDefaultButton2, "Deletion Confirmation") = vbNo Then Cancelled = True: GoTo ExitLable

'Delete Item

Conn1.Execute "DELETE FROM ACTrans WHERE ACCode = '" & txtAddress.Tag & "'"

Conn1.Execute "DELETE FROM ACMast WHERE ACCode = '" & txtAddress.Tag & "'"

Conn1.Execute "delete from hospital where registration = " & txtRegNo & ""

Conn1.Execute "delete from addmission where refno = " & txtRegNo & ""

Conn1.Execute "delete from addmission1 where refno = " & txtRegNo & ""

Conn1.Execute "delete from bill where registrationno = " & txtRegNo & ""

Conn1.Execute "delete from prescription where refno = " & txtRegNo & ""

Conn1.Execute "delete from visit where regno = " & txtRegNo & ""

Conn1.Execute "delete from ultrasound1 where id = " & txtRegNo & ""

Conn1.Execute "delete from dischargeticket where regno = " & txtRegNo & ""

Conn1.Execute "delete from workdone where regno = " & txtRegNo & ""

Conn1.Execute "delete from rcptmast where id = " & txtRegNo & ""

Conn1.Execute "delete from issue where refno = " & txtRegNo & ""

Conn1.Execute "delete from return where refno = " & txtRegNo & ""

Conn1.Execute "delete from datewiseinvest where regno=" & txtRegNo & ""

Conn1.CommitTrans

ExitLable:

If Cancelled Then Conn1.RollbackTrans

ADDMode = False

EditMode = False

Call ClearFields

Call SetControls

End Sub

Private Sub EditCmd_Click()

EditMode = True

Call SetControls

Call ClearFields

Call SetSearchEngines

'Conn1.BeginTrans

txtRegNo.SetFocus

End Sub

Private Sub SetSearchEngines()

'Called in Form_Load()

With PatientSrch

.DBConnectString = ConnectString

.SQLString = "SELECT Registration,CONVERT(NVARCHAR,Registration) + space(1) + Title + space(1) + First_Name + space(1) + Middle_Name + space(1) + Last_Name FROM Hospital"

.PopulateList

Set .BoundTextBox = Me.txtRegNo

End With

With DeptSrch

.DBConnectString = ConnectString

.SQLString = "SELECT DCode, DepartmentName FROM Department"

.PopulateList

Set .BoundTextBox = Me.TxtDept

End With

With DocSrch

.DBConnectString = ConnectString

.SQLString = "SELECT id,Title + space(1) + FName + space(1) + MName + space(1) + LName FROM DocMast"

.PopulateList

Set .BoundTextBox = Me.TxtDoctorIncharge

End With

End Sub

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

'************** Press Exit Button *****************

If KeyCode = vbKeyT And Shift = vbCtrlMask Then

If CmdExit.Enabled = True Then Call CmdExit_Click

'************** Press New Button *****************

ElseIf KeyCode = vbKeyN And Shift = vbCtrlMask Then

If AddCmd.Enabled = True Then Call AddCmd_Click

'************** Press edit Button *****************

ElseIf KeyCode = vbKeyE And Shift = vbCtrlMask Then

If EditCmd.Enabled = True Then Call EditCmd_Click

'************** Press Delete Button *****************

ElseIf KeyCode = vbKeyD And Shift = vbCtrlMask Then

If DelCmd.Enabled = True Then Call DelCmd_Click

'************** Press Save Button *****************

ElseIf KeyCode = vbKeyS And Shift = vbCtrlMask Then

If SaveCmd.Enabled = True Then Call SaveCmd_Click

'************** Press Search Button *****************

ElseIf KeyCode = vbKeyH And Shift = vbCtrlMask Then

If SearchCmd.Enabled = True Then Call SearchCmd_Click

'************** Press Cancel Button *****************

ElseIf KeyCode = vbKeyC And Shift = vbCtrlMask Then

If cmdCancel.Enabled = True Then Call cmdCancel_Click

'************** Press Print Button *****************

ElseIf KeyCode = vbKeyP And Shift = vbCtrlMask Then

If CmdPreview.Enabled = True Then Call CmdPreview_Click

'************** Press Report Button *****************

ElseIf KeyCode = vbKeyR And Shift = vbCtrlMask Then

If CmdReport.Enabled = True Then Call CmdReport_Click

'************** Press I Card Button *****************

ElseIf KeyCode = vbKeyI And Shift = vbCtrlMask Then

If CmdICard.Enabled = True Then Call CmdICard_Click

'************** Press Show Report Button *****************

ElseIf KeyCode = vbKeyO And Shift = vbCtrlMask Then

If CmdShowReport.Enabled = True Then Call CmdShowReport_Click

End If

If KeyCode = vbKeyF1 Or KeyCode = vbKeyF2 Or KeyCode = vbKeyF3 Or KeyCode = vbKeyF4 Or _

KeyCode = vbKeyF5 Or KeyCode = vbKeyF6 Or KeyCode = vbKeyF7 Or KeyCode = vbKeyF8 Or _

KeyCode = vbKeyF8 Or KeyCode = vbKeyF9 Or KeyCode = vbKeyF10 Then

If Not EditMode = True Then MsgBox "Please Open Patient Record In Edit Mode Then Perform Any Operation", vbExclamation + vbDefaultButton1, App.Title: EditCmd.Enabled = True: EditCmd.SetFocus: Exit Sub

If registration.txtRegNo = "" Then MsgBox "First Enter the Registration NO.!", vbExclamation: registration.Enabled = True: Exit Sub

If Me.txtfirst = "" Then MsgBox "Please Fill Patient Name First Before Open Any other Form", vbExclamation + vbDefaultButton1, App.Title: txtfirst.SetFocus: Exit Sub

If Me.TxtDoctorIncharge = "" Then MsgBox "Please Select Doctor Name First Before Open Any other Form", vbExclamation + vbDefaultButton1, App.Title: TxtDoctorIncharge.SetFocus: Exit Sub

Unload Prescription

Unload visit

Unload certificate

Unload UltraSound

Unload Admission

Unload bills

End If

If KeyCode = vbKeyF1 Then

Load Admission

ElseIf KeyCode = vbKeyF2 Then

Load Prescription

ElseIf KeyCode = vbKeyF3 Then

Load datewiseinvest

ElseIf KeyCode = vbKeyF4 Then

Load visit

ElseIf KeyCode = vbKeyF5 Then

Load UltraSound

ElseIf KeyCode = vbKeyF6 Then

work.Show

ElseIf KeyCode = vbKeyF7 Then

MsgBox "Not Implemented.........", vbInformation

' ElseIf KeyCode = vbKeyF8 Then

' Load receipts

ElseIf KeyCode = vbKeyF8 Then

bills.Show

Call bills.connect

bills.txtRegNo = txtRegNo.Text

ElseIf KeyCode = vbKeyF9 Then

Load certificate

ElseIf KeyCode = vbKeyF10 Then

Load DischargeTicket

End If

End Sub

Private Sub Form_Load()

Set Conn1 = New ADODB.Connection

Conn1.CursorLocation = adUseClient

Conn1.Open ConnectString

Label1(2).Visible = True

DTPicker2.Visible = True

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

MSFlexGrid1(0).Rows = 1

MSFlexGrid1(0).AddItem "Admission (F1)"

MSFlexGrid1(0).AddItem "Prescription (F2)"

MSFlexGrid1(0).AddItem "Investigation (F3)"

MSFlexGrid1(0).AddItem "Visit (F4)"

MSFlexGrid1(0).AddItem "Ultrasound (F5)"

MSFlexGrid1(0).AddItem "Work Done (F6)"

MSFlexGrid1(0).AddItem "Lab Report (F7)"

' MSFlexGrid1(0).AddItem "Receipt (F8)"

MSFlexGrid1(0).AddItem "Bill (F8)"

MSFlexGrid1(0).AddItem "Certificate (F9)"

MSFlexGrid1(0).AddItem "Discharge Ticket (F10)"

TxtRegDate = Date

TxtTime = Time

Call SetSearchEngines

Call SetControls

End Sub

Private Sub Form_Unload(Cancel As Integer)

On Error Resume Next

If (ADDMode Or EditMode) Then

Cancel = True

Exit Sub

End If

Conn1.Close

Set Conn1 = Nothing

End Sub

Private Sub Form_Activate()

On Error Resume Next

Me.WindowState = vbMaximized

Set Conn1 = New ADODB.Connection

Conn1.CursorLocation = adUseClient

Conn1.Open ConnectString

Timer1.Enabled = True

End Sub

Private Sub ClearFields()

'To Clear forms fields

'Called in AddCmd_Click()

Set rst = New ADODB.Recordset

rst.Open "select max(registration) from hospital", Conn1, adOpenDynamic, adLockOptimistic

If IsNull(rst.Fields(0)) = True Then

txtRegNo = "1"

rst.Close

Exit Sub

Else

txtRegNo = rst.Fields(0) + 1

End If

rst.Close

Unload SearchFrm

txtfirst = "": txtmiddle = "": txtlast = "": TxtRegFee = ""

txtOccupiation = "": TxtAge = "": TxtFather = "": TxtDocITel = ""

TxtDocFTel = "": txtnotes = "": TxtPurpose = "": TxtDept = ""

Combo7 = "": TxtDocFamily = "": TxtDoctorIncharge = "": txtAddress = ""

txtcity = "": Text22 = "": Text24 = "": Text36 = ""

Text37 = "": Text52 = "": Text34 = "": Text32 = ""

Text30 = "": Text38 = "": Text39 = "": Text42 = ""

Text43 = "": Text46 = "": Text49 = "": Text41 = ""

Text35 = "": Text33 = "": Text31 = "": Text40 = ""

Text44 = "": Text45 = "": Text48 = "": Text47 = ""

Text22 = 0: TxtPhoneOff = 0: TxtPhoneRes = 0: Text54 = 0

Text55 = 0: Text57 = 0: txtAddress.Tag = "": TxtOPDID.Text = ""

End Sub

Private Sub SetFieldsValues(DocID As String)

'Set database values in the forms fields

'Called in ItemDBCtl_MoveComplete()

If DocID = "" Then Exit Sub

Set rst = New ADODB.Recordset

rst.Open "select * from Hospital where Registration =" & DocID & "", Conn1, adOpenDynamic, adLockOptimistic

On Error GoTo ErHand

'If Not (Rst.RecordCount > 0) Then Call ClearFields: Exit Sub

If rst.EOF Then Exit Sub

If rst.BOF Then Exit Sub

registration.txtRegNo = rst!registration & ""

registration.TxtRegFee = rst!registrationfees & ""

registration.TxtMarriageDate = rst!dateofmarriage

registration.TxtRegDate = rst!registration_date

registration.TxtTime = rst!registration_time

registration.TxtDept = rst!Company & ""

registration.TxtTitle = rst!Title & ""

registration.txtfirst = rst!first_name & ""

registration.txtmiddle = rst!middle_name & ""

registration.txtlast = rst!last_name & ""

registration.DTPicker2 = rst!date_of_birth

registration.TxtSex = rst!sex & ""

registration.TxtAge = rst!Age & ""

registration.TxtMarried = rst!marital_status & ""

registration.Combo4 = rst!blood_group & ""

registration.txtOccupiation = rst!occupation & ""

registration.Combo5 = rst!religion & ""

registration.TxtFather = rst!FATHER_NAME & ""

registration.Combo7 = rst!ref_doctor_name & ""

registration.TxtDocITel = rst!ref_tel & ""

registration.TxtDocFamily = rst!family_doctor_name & ""

registration.TxtDocFTel = rst!fem_tel & ""

registration.txtnotes = rst!notes & ""

registration.TxtPurpose = rst!purpose_for_visit & ""

registration.TxtDoctorIncharge = rst!Doctor_incharge & ""

registration.TxtOPDID.Text = rst!OPDID & ""

registration.txtAddress = rst!street & ""

registration.txtcity = rst!City & ""

registration.Text23 = rst!State & ""

registration.Text26 = rst!COUNTRY & ""

registration.Text22 = rst!zip & ""

registration.TxtPhoneRes = rst!phone_R & ""

registration.TxtPhoneOff = rst!phone_O & ""

registration.Text24 = rst!e_mail & ""

registration.Text36 = rst!cstreet & ""

registration.Text37 = rst!ccity & ""

registration.Text53 = rst!cstate & ""

registration.Text50 = rst!ccountry & ""

registration.Text51 = rst!cphone_r & ""

registration.Text55 = rst!cphone_o & ""

registration.Text52 = rst!ce_mail & ""

registration.Text54 = rst!czip & ""

registration.Text30 = rst!gp_rh & ""

registration.Text31 = rst!VDRL & ""

registration.Text32 = rst!HIV & ""

registration.Text33 = rst!HBS & ""

registration.Text34 = rst!lmp & ""

registration.Text35 = rst!EDD & ""

registration.Text38 = rst!Gravindex_text & ""

registration.Text39 = rst!FBS & ""

registration.Text40 = rst!PPBS & ""

registration.Text41 = rst!personal_history & ""

registration.Text42 = rst!HB & ""

registration.Text44 = rst!MH & ""

registration.Text43 = rst!urine_exam & ""

registration.Text45 = rst!obst_history & ""

registration.Text46 = rst!DIABETES & ""

registration.Text48 = rst!USG & ""

registration.Text49 = rst!general_exam & ""

registration.Text47 = rst!hypertension & ""

txtAddress.Tag = rst!AccountNo & ""

TxtOPDID.Text = rst!OPDID & ""

With Me

End With

ErHand:

ErrHandler "Registration.SetFieldsValues()"

End Sub

Private Sub SaveCmd_Click()

If Not SavedData Then Exit Sub

Conn1.CommitTrans

PatientSrch.PopulateList

ADDMode = False

EditMode = False

Call SetControls

End Sub

Private Sub Timer1_Timer()

If Not EditMode Then TxtTime = Time

End Sub

Private Sub TxtDoctorIncharge_GotFocus()

DocSrch.SearchValue TxtDoctorIncharge

DocSrch.PopulateList

End Sub

Private Sub TxtRegNo_GotFocus()

If EditMode Then

PatientSrch.SearchValue txtRegNo

PatientSrch.PopulateList

End If

End Sub

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

On Error Resume Next

If KeyCode = vbEnter Or KeyCode = 13 Then

Dim i As String

i = txtRegNo.Text

Call EditCmd_Click

txtRegNo.Text = i

SendKeys "{TAB}"

End If

End Sub

Private Sub TxtRegNo_LostFocus()

If Not (ADDMode Or EditMode) Then Exit Sub

If Not Trim(txtRegNo) = "" Then

Call SetFieldsValues(txtRegNo.Text)

End If

End Sub

Private Function ValidateData() As Boolean

With Me

If Trim(.txtRegNo) = "" Then

MsgBox "Please Fill Registration Number.", vbCritical, "Missing values"

.txtRegNo.SetFocus

ElseIf Trim(.TxtRegFee) = "" Then

MsgBox "Please Fill Registration Fee.", vbCritical, "Missing values"

.TxtRegFee.SetFocus

ElseIf Trim(.txtfirst) = "" Then

MsgBox "Please Fill Patient's First Name.", vbCritical, "Missing values"

.txtfirst.SetFocus

ElseIf Trim(.TxtDept) = "" Then

MsgBox "Please Select Department's Name.", vbCritical, "Missing values"

.TxtDept.SetFocus

ElseIf Trim(.TxtDoctorIncharge) = "" Then

MsgBox "Please Select Doctor's Name.", vbCritical, "Missing values"

.TxtDoctorIncharge.SetFocus

ElseIf Trim(.TxtSex) = "" Then

MsgBox "Please Select Sex.", vbCritical, "Missing values"

.TxtSex.SetFocus

ElseIf Trim(.TxtAge) = "" Then

MsgBox "Please Fill Age.", vbCritical, "Missing values"

.TxtAge.SetFocus

Else

ValidateData = True

End If

End With

End Function

Private Function GetItemCode()

On Error GoTo SAM

Dim RS As New ADODB.Recordset

RS.Open "Select Max(Registration) From Hospital", Conn1, adOpenDynamic, adLockOptimistic

GetItemCode = GetProperCode(IIf(IsNull(RS(0)), "1", RS(0) + 1), 4)

SAM:

End Function

Private Function SavedData() As Boolean

On Error GoTo ErrLbl

If Not ValidateData Then Exit Function

Dim AccountName As String

Dim GroupNO As String

AccountName = TxtTitle & " " & txtfirst & " " & txtmiddle & " " & txtlast

Conn1.BeginTrans

'*************** Patient Account Group Code

GroupNO = "Patient Account"

' Create A New Account For This Doctor Or Update A Existing Account *********

Dim SQL As String

Dim rst As New ADODB.Recordset

rst.CursorLocation = adUseClient

If ADDMode Then

SQL = "select * from Hospital"

Else

SQL = "select * from Hospital where registration = " & txtRegNo & ""

End If

rst.Open SQL, Conn1, adOpenKeyset, adLockOptimistic, adCmdText

With Me

If ADDMode Then

rst.AddNew

txtRegNo = GetItemCode()

rst("Registration") = txtRegNo

End If

TxtTime.Value = Time

txtAddress.Tag = SaveAccount(txtAddress.Tag, AccountName, GroupNO, ADDMode, txtcity, txtAddress, TxtPhoneOff, TxtPhoneRes, "RegNo : " & Val(txtRegNo))

If txtAddress.Tag = "" Then Set rst = Nothing: Exit Function

rst("title") = TxtTitle & ""

rst("registrationfees") = TxtRegFee & ""

rst("dateOfMarriage") = TxtMarriageDate & ""

rst("registration_date") = TxtRegDate & ""

rst("registration_time") = TxtTime & ""

rst("company") = TxtDept & ""

rst("first_name") = txtfirst & ""

rst("middle_name") = txtmiddle & ""

rst("last_name") = txtlast & ""

rst("date_of_birth") = DTPicker2 & ""

rst("sex") = TxtSex & ""

rst("age") = TxtAge & ""

rst("Marital_Status") = TxtMarried & ""

rst("Blood_Group") = Combo4 & ""

rst("Occupation") = txtOccupiation & ""

rst("Religion") = Combo5 & ""

rst("father_name") = TxtFather & ""

rst("Ref_Doctor_Name") = Combo7 & ""

rst("Ref_Tel") = TxtDocITel & ""

rst("Family_Doctor_Name") = TxtDocFamily & ""

rst("Fem_Tel") = TxtDocFTel & ""

rst("Notes") = txtnotes & ""

rst("Purpose_For_Visit") = TxtPurpose & ""

rst("Doctor_Incharge") = TxtDoctorIncharge & ""

rst("Street") = txtAddress & ""

rst("City") = txtcity & ""

rst("State") = Text23 & ""

rst("Country") = TxtRegFee & ""

rst("Zip") = Text22 & ""

rst("Phone_R") = TxtPhoneRes & ""

rst("Phone_o") = TxtPhoneOff & ""

rst("E_mail") = Text24 & ""

rst("cStreet") = Text36 & ""

rst("cCity") = Text37 & ""

rst("cState") = Text53 & ""

rst("cCountry") = Text50 & ""

rst("cZip") = Text54 & ""

rst("cPhone_R") = Text51 & ""

rst("cPhone_o") = Text55 & ""

rst("cE_mail") = Text52 & ""

rst("Gp_RH") = Text30 & ""

rst("VDRL") = Text31 & ""

rst("HIV") = Text32 & ""

rst("HBs") = Text33 & ""

rst("LMP") = Text34 & ""

rst("EDD") = Text35 & ""

rst("Gravindex_Text") = Text38 & ""

rst("FBS") = Text39 & ""

rst("PPBS") = Text40 & ""

rst("PERSONAL_HISTORY") = Text41 & ""

rst("HB") = Text42 & ""

rst("MH") = Text44 & ""

rst("URINE_EXAM") = Text43 & ""

rst("OBST_HISTORY") = Text45 & ""

rst("DIABETES") = Text46 & ""

rst("USG") = Text48 & ""

rst("GENERAL_EXAM") = Text49 & ""

rst("HYPERTENSION") = Text47 & ""

rst!AccountNo = txtAddress.Tag & ""

rst("OPDID") = TxtOPDID.Text & ""

rst.UpdateBatch

End With

SavedData = True

Call ClearFields

Exit Function

ErrLbl:

ErrHandler "Function Registration.SavedData"

End Function

Private Sub CmdICard_Click()

On Error GoTo ErHand

Set rst = New ADODB.Recordset

rst.Open "select registration from hospital where registration=" & Val(txtRegNo) & "", Conn1, adOpenDynamic, adLockOptimistic

If rst.EOF = True Then

MsgBox "Record not found!", vbCritical

End If

Set rst = Nothing

picard.Show

ErHand:

ErrHandler "Registration.CmdICard_Click()"

End Sub

Private Sub SearchCmd_Click()

SearchFrm.Show

End Sub

Private Sub MSFlexGrid1_DblClick(Index As Integer)

Unload Prescription

Unload visit

Unload certificate

Unload UltraSound

Unload Admission

Unload bills

' Unload Issue_Ledger

' Unload receipts

If Not EditMode = True Then MsgBox "Please Open Patient Record In Edit Mode Then Perform Any Operation", vbExclamation + vbDefaultButton1, App.Title: EditCmd.Enabled = True: EditCmd.SetFocus: Exit Sub

If registration.txtRegNo = "" Then

MsgBox "First Enter the Registration NO.!", vbExclamation

registration.Enabled = True

Exit Sub

Else

If Me.txtfirst = "" Then MsgBox "Please Fill Patient Name First Before Open Any other Form", vbExclamation + vbDefaultButton1, App.Title: txtfirst.SetFocus: Exit Sub

If Me.TxtDoctorIncharge = "" Then MsgBox "Please Select Doctor Name First Before Open Any other Form", vbExclamation + vbDefaultButton1, App.Title: TxtDoctorIncharge.SetFocus: Exit Sub

If MSFlexGrid1(0).Text = "Admission (F1)" Then

Load Admission

ElseIf MSFlexGrid1(0).Text = "Prescription (F2)" Then

Load Prescription

ElseIf MSFlexGrid1(0).Text = "Investigation (F3)" Then

Load datewiseinvest

datewiseinvest.txtRegNo = registration.txtRegNo

ElseIf MSFlexGrid1(0).Text = "Visit (F4)" Then

Load visit

ElseIf MSFlexGrid1(0).Text = "Ultrasound (F5)" Then

Load UltraSound

ElseIf MSFlexGrid1(0).Text = "Work Done (F6)" Then

work.Show

ElseIf MSFlexGrid1(0).Text = "Lab Report (F7)" Then

'ElseIf MSFlexGrid1(0).text = "Receipt (F8)" Then

' Load receipts

ElseIf MSFlexGrid1(0).Text = "Bill (F8)" Then

bills.Show

Call bills.connect

ElseIf MSFlexGrid1(0).Text = "Certificate (F9)" Then

Load certificate

certificate.Text2 = registration.txtRegNo

ElseIf MSFlexGrid1(0).Text = "Discharge Ticket (F10)" Then

Load DischargeTicket

End If

End If

End Sub

Private Sub TxtDept_GotFocus()

DeptSrch.SearchValue TxtDept

End Sub

Private Sub Text41_LostFocus()

Command5.SetFocus

End Sub

'*****************************************************************************

Private Sub CmdReport_Click()

XRAY.Show

End Sub

Private Sub CmdPreview_Click()

If txtRegNo = "" Then

MsgBox "Please enter Registration No.", vbInformation

txtRegNo.SetFocus

Exit Sub

End If

On Error Resume Next

DataEnvironment1.Recordsets.Item("command1").Close

DataEnvironment1.Recordsets.Item("command1").Open "select * from hospital where registration = " & txtRegNo & "", Conn1, adOpenDynamic, adLockOptimistic

RegistrationReport.Sections(1).Controls.Item("label57").Caption = hos_name

RegistrationReport.Sections(1).Controls.Item("label58").Caption = hos_add

RegistrationReport.Show

End Sub

Private Sub CmdShowReport_Click()

If CmdShowReport.Caption = "Sh&ow Report Entry" Then

Me.RegistrationFrame.Visible = False

Me.ReportFrame.Visible = True

CmdShowReport.Caption = "Hide Report Entry"

ElseIf CmdShowReport.Caption = "Hide Report Entry" Then

Me.RegistrationFrame.Visible = True

Me.ReportFrame.Visible = False

CmdShowReport.Caption = "Sh&ow Report Entry"

End If

End Sub

Public Sub Transfer()

Call AddCmd_Click

End Sub