⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmappoinments.frm

📁 This file came from Planet-Source-Code.com...the home millions of lines of source code You can view
💻 FRM
📖 第 1 页 / 共 2 页
字号:
    .FixedRows = 1
    .RowHeight(0) = .RowHeight(1) * 1.5
    
    '.FontWidthFixed = 5
 
    
End With

Functions.SizeColumns MSHFlexGrid1, Me

rsAppointment.Close

End Sub


Private Sub cmdServiceAppointment_Click()
Dim SQL As String
Dim icol As Integer
Set rsAppointment = New ADODB.Recordset
'create sql statement

SQL = "SELECT * FROM Service_Appointment ORDER BY Appointment_Date, Appointment_Time "

Set rsAppointment.ActiveConnection = cnPatients
rsAppointment.Open SQL

With MSHFlexGrid1
    .clear
    .Rows = 1
    .Cols = rsAppointment.Fields.Count
  

    While Not rsAppointment.EOF
        .Rows = .Rows + 1
        .Row = .Rows - 1


        For icol = 0 To rsAppointment.Fields.Count - 1
            .Col = icol
            .Text = rsAppointment(icol) & ""
        Next
        rsAppointment.MoveNext
    Wend

    .TextMatrix(0, 0) = "Appointment Number"
    .TextMatrix(0, 1) = "Patient ID"
    .TextMatrix(0, 2) = "Service ID"
    .TextMatrix(0, 3) = "Appointment Date"
    .TextMatrix(0, 4) = "Appointment Time"

    .FixedRows = 1
    .RowHeight(0) = .RowHeight(1) * 1.5
 
    
End With

Functions.SizeColumns MSHFlexGrid1, Me

rsAppointment.Close

End Sub


Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Call Functions.DisableMenu
Call FillTable
MonthView1.Value = Now
End Sub

Private Sub Form_Unload(Cancel As Integer)
Call Functions.EnableMenu
End Sub

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
Dim SQL As String
Dim RowNo As Integer
Set rsAppointment = New ADODB.Recordset

MSHFlexGrid1.clear

    If AppointmentSelect = 0 Then
        'create sql statement
        SQL = "SELECT * From Doctor_Appointment, Patient_Details WHERE Doctor_Appointment.Appointment_Date =#" & SQLDate(DateClicked) & "#" & " and Doctor_Appointment.Patient_ID=Patient_Details.Patient_ID ORDER BY Appointment_Date, Appointment_Time" & ";"
    ElseIf AppointmentSelect = 1 Then
        'create sql statement
        SQL = "SELECT * From Service_Appointment, Patient_Details WHERE Appointment_Date =#" & SQLDate(DateClicked) & "#" & " and Service_Appointment.Patient_ID=Patient_Details.Patient_ID ORDER BY Appointment_Date, Appointment_Time" & ";"
    End If



Set rsAppointment.ActiveConnection = cnPatients

rsAppointment.Open SQL

If Not rsAppointment.EOF Then ' If results found
    With MSHFlexGrid1
        .clear
        .Rows = 1
        .Cols = rsAppointment.Fields.Count
        
        RowNo = 1

            While Not rsAppointment.EOF
                .Rows = .Rows + 1
                .Row = .Rows - 1
                .TextMatrix(RowNo, 0) = rsAppointment![Appointment_ID]
                .TextMatrix(RowNo, 1) = rsAppointment![First_Name]
                .TextMatrix(RowNo, 2) = rsAppointment![Last_Name]
                .TextMatrix(RowNo, 3) = rsAppointment![Gender]
                .TextMatrix(RowNo, 4) = rsAppointment![address]
                .TextMatrix(RowNo, 5) = rsAppointment![Telephone]
                
                If AppointmentSelect = 0 Then
                    .TextMatrix(RowNo, 6) = rsAppointment![Doctor_ID]
                ElseIf AppointmentSelect = 1 Then
                    .TextMatrix(RowNo, 6) = rsAppointment![Hospital_SErvice_ID]
                End If
                
                .TextMatrix(RowNo, 7) = rsAppointment![Appointment_Time]
            
                rsAppointment.MoveNext
                RowNo = RowNo + 1
            Wend

        ' Set Column Headers

        .TextMatrix(0, 0) = "Appointment ID"
        .TextMatrix(0, 1) = "First Name"
        .TextMatrix(0, 2) = "Last Name"
        .TextMatrix(0, 3) = "Gender"
        .TextMatrix(0, 4) = "Address"
        .TextMatrix(0, 5) = "Phone Number"
        .TextMatrix(0, 6) = "Doctor / Service"
        .TextMatrix(0, 7) = "Time"
        .FixedRows = 1
        .RowHeight(0) = .RowHeight(1) * 1.5
        
        Functions.SizeColumns MSHFlexGrid1, Me

    End With

Else ' If no Results Found

   With MSHFlexGrid1
        
        .Cols = 8
        .clear
        
        .TextMatrix(0, 0) = "Appointment ID"
        .TextMatrix(0, 1) = "First Name"
        .TextMatrix(0, 2) = "Last Name"
        .TextMatrix(0, 3) = "Gender"
        .TextMatrix(0, 4) = "Address"
        .TextMatrix(0, 5) = "Phone Number"
        .TextMatrix(0, 6) = "Doctor / Service"
        .TextMatrix(0, 7) = "Time"
        
        .FixedRows = 1
        .RowHeight(0) = .RowHeight(1) * 1.5

        '.FontWidth = 6
        Functions.SizeColumnHeaders MSHFlexGrid1, Me
    End With



End If

rsAppointment.Close

End Sub



Private Sub optApppointment_Click(Index As Integer)
    
    Select Case (Index)
        Case "0" ' Doctor Appointments
           AppointmentSelect = 0
           Call MonthView1_DateClick(MonthView1.Value)
           
           
        Case "1" 'Other Hospital Services Appointments
            AppointmentSelect = 1
            Call MonthView1_DateClick(MonthView1.Value)
           

        Case Else 'None
            
    End Select

End Sub



Public Sub FillTable()

Dim rsAppointment2 As Recordset
Dim SQL1 As String
Dim SQL2 As String
Dim icol As Integer

Set rsAppointment = New ADODB.Recordset
Set rsAppointment2 = New ADODB.Recordset

'create sql statement

SQL1 = "SELECT * FROM Doctor_Appointment WHERE Doctor_Appointment.Appointment_Date =#" & Format(Date, "dd-MMM-yyyy") & "# "
SQL2 = "SELECT * FROM Service_Appointment WHERE Service_Appointment.Appointment_Date =#" & Format(Date, "dd-MMM-yyyy") & "#"
Set rsAppointment.ActiveConnection = cnPatients
Set rsAppointment2.ActiveConnection = cnPatients

rsAppointment.Open SQL1
rsAppointment2.Open SQL2



If rsAppointment.EOF = False Or rsAppointment2.EOF = False Then

With MSHFlexGrid1
    .clear
    .Rows = 1
    .Cols = rsAppointment.Fields.Count
   
  


    While Not rsAppointment.EOF
        .Rows = .Rows + 1
        .Row = .Rows - 1


        For icol = 0 To rsAppointment.Fields.Count - 1
            .Col = icol
            .Text = rsAppointment(icol) & ""
        Next
        rsAppointment.MoveNext
    Wend
    
    
    While Not rsAppointment2.EOF
        .Rows = .Rows + 1
        .Row = .Rows - 1


        For icol = 0 To rsAppointment2.Fields.Count - 1
            .Col = icol
            .Text = rsAppointment2(icol) & ""
        Next
        rsAppointment2.MoveNext
    Wend

    .TextMatrix(0, 0) = "Appointment ID"
    .TextMatrix(0, 1) = "Patient ID"
    .TextMatrix(0, 2) = "Doctor / Service ID"
    .TextMatrix(0, 3) = "Appointment Date"
    .TextMatrix(0, 4) = "Appointment Time"

    .FixedRows = 1
    .RowHeight(0) = .RowHeight(1) * 1.5

End With

Functions.SizeColumns MSHFlexGrid1, Me

rsAppointment.Close
End If


End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -