Student Information in Computer Room Fee Collection System

Keywords: Programming

Preface

Combination query is one of the three most difficult points in computer room, but when it is finished, it will be open-minded, which is a matter of one sentence. It took me several days to figure it out. Let me start with my thoughts.

thinking

Key codes:

Private Sub ComboField2_Click()
    If ComboField2.Text = "Date of boarding" Or ComboField2.Text = "Boarding time" Or ComboField2.Text = "Date of landing" Or ComboField2.Text = "Downtime" Then
        txtContent2.Visible = False
        DTPicker2.Visible = True
    End If
        If ComboField2.Text = "Date of boarding" Or ComboField2.Text = "Date of landing" Then
         DTPicker2.Format = dtpShortDate
         DTPicker2.Value = CDate(Format(DTPicker2.Value, "yyyy-mm-dd"))
        Else
        If ComboField2.Text = "Boarding time" Or ComboField2.Text = "Downtime" Then
         DTPicker2.Format = dtpTime
         Else
        txtContent2.Visible = True
        DTPicker2.Visible = False
        End If
        End If
End Sub
Private Sub Command2_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL, MsgText$
 txtSQL = "select*from Line_info "
    If Not testtxt(ComboField1.Text) Then
        MsgBox "Please select the field name", 48, "Tips"
        Exit Sub
    Else
    If Not testtxt(ComboOpsign1.Text) Then
        MsgBox "Please select the operator", 48, "Tips"
        Exit Sub
    Else
    If Not testtxt(txtContent1.Text) And Not testtxt(DTPicker1.Value) Then
        MsgBox "Please enter what you want to query.", 48, "Tips"
        Exit Sub
    Else
    If txtContent1.Visible = False Then
    txtSQL = "select*from Line_info where " & FiledName(ComboField1.Text) & ComboOpsign1.Text & "'" & DTPicker1.Value & " ' "
    Else
    txtSQL = "select*from Line_info where " & FiledName(ComboField1.Text) & ComboOpsign1.Text & "'" & txtContent1.Text & " ' "
        'txtSQL = txtSQL & FiledName(ComboField1.Text) & " " & ComboOpsign1.Text & " '" & Trim(txtContent1.Text) & "'"
    End If
    End If
    End If
    End If
        If Trim(ComboCombineRelation1.Text <> "") Then
            If Trim(ComboField2.Text) = "" Or Trim(ComboOpsign2.Text) = "" Or (Trim(txtContent2.Text) = "" And DTPicker2.Value = "") Then
                MsgBox "You have chosen the combination relationship. Please enter the data and then query it.", vbOKOnly, "Prompt information"
                Exit Sub
            Else
            If txtContent2.Visible = False Then
                txtSQL = txtSQL & Connect(ComboCombineRelation1.Text) & FiledName(ComboField2.Text) & ComboOpsign2.Text & " '" & Trim(DTPicker2.Value) & "'"
             Else
                txtSQL = txtSQL & Connect(ComboCombineRelation1.Text) & FiledName(ComboField2.Text) & ComboOpsign2.Text & " '" & Trim(txtContent2.Text) & "'"
        '        txtSQL = "select*from Line_info where " & Connect(ComboCombineRelation1.Text) & FiledName(ComboField2.Text) & ComboOpsign2.Text & Trim(txtContent2.Text) & ""
            End If
            End If
        End If

summary

That's the point. It's not very difficult to understand. The three combination query forms are similar, so it's not difficult to solve the other two.

Posted by ILYAS415 on Fri, 25 Jan 2019 03:39:13 -0800