Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdClear_Click()
'clear the form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub cmdOK_Click()
Dim RowCount As Long
Dim ctl As Control
' check user iput
If Me.cboward.Value = "" Then
MsgBox "Please enter a ward.", vbExclamation, "Staff Expenses"
Me.cboward.SetFocus
Exit Sub
End If
If Not IsNumeric(Me.txtHN.Value) Then
MsgBox "The HN box must contain a number.", vbExclamation, "Staff Expenses"
Me.txtHN.SetFocus
Exit Sub
End If
If Me.txtname.Value = "" Then
MsgBox "Please enter a patients Names.", vbExclamation, "Staff Expenses"
Me.txtname.SetFocus
Exit Sub
End If
If Not IsNumeric(Me.txtage.Value) Then
MsgBox "The Age box must contain a number.", vbExclamation, "Staff Expenses"
Me.txtage.SetFocus
Exit Sub
End If
If Me.txtvillage.Value = "" Then
MsgBox "Please enter the Village.", vbExclamation, "Staff Expenses"
Me.txtvillage.SetFocus
Exit Sub
End If
If Me.cbodistrict.Value = "" Then
MsgBox "Please enter the District.", vbExclamation, "Staff Expenses"
Me.cbodistrict.SetFocus
Exit Sub
End If
If Me.cboprovince.Value = "" Then
MsgBox "Please enter the Province.", vbExclamation, "Staff Expenses"
Me.cboprovince.SetFocus
Exit Sub
End If
If Me.cbokind.Value = "" Then
MsgBox "Please enter the kind.", vbExclamation, "Staff Expenses"
Me.cbokind.SetFocus
Exit Sub
End If
If Me.txtcause.Value = "" Then
MsgBox "Please enter the Chief complaints.", vbExclamation, "Staff Expenses"
Me.txtcause.SetFocus
Exit Sub
End If
If Not IsDate(Me.txtdatein.Value) Then
MsgBox "The Date box must contain a date in.", vbExclamation, "Staff Expenses"
Me.txtdatein.SetFocus
Exit Sub
End If
' Write data to worksheet
RowCount = Worksheets("Patients").Range("A5").CurrentRegion.Rows.Count
With Worksheets("Patients").Range("A5")
.Offset(RowCount, 0).Value = Me.cboward.Value
.Offset(RowCount, 1).Value = Me.txtHN.Value
.Offset(RowCount, 2).Value = Me.txtname.Value
.Offset(RowCount, 3).Value = Me.txtage.Value
If Me.optionman.Value = True Then
.Offset(RowCount, 4).Value = "Male"
Else: .Offset(RowCount, 4).Value = "Female"
End If
.Offset(RowCount, 5).Value = Me.txtvillage.Value
.Offset(RowCount, 6).Value = Me.cbodistrict.Value
.Offset(RowCount, 7).Value = Me.cboprovince.Value
.Offset(RowCount, 8).Value = Me.cbokind.Value
.Offset(RowCount, 9).Value = Me.txtcause.Value
.Offset(RowCount, 10).Value = DateValue(Me.txtdatein.Value)
.Offset(RowCount, 11).Value = Me.cbodiagnosis.Value
.Offset(RowCount, 12).Value = DateValue(Me.txtdateout.Value)
If Me.chkdead.Value = True Then
.Offset(RowCount, 13).Value = "Yes"
Else: .Offset(RowCount, 13).Value = "No"
End If
.Offset(RowCount, 14).Value = Format(Now, "dd/mm/yyyy hh:nn:ss")
End With
'Clear the form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub cmdsearch_Click()
End Sub
Private Sub cmdupdate_Click()
End Sub