1.通过学号显示姓名
添加如下代码即可。
Private Sub comboSID_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
'通过学号,显示姓名
txtSQL = "select * from student_Info where class_No = '" & Trim(comboClassno.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtName.Text = mrc!student_Name
mrc.Close
End Sub
2.两个日期进行比较
Private Sub cmdOK_Click()
If Now < CDate(DTPicker1.Value) Then
MsgBox "出生日期比当前时间晚,请重新输入!"
DTPicker1 = ""
Exit Sub
End If
If Now < CDate(DTPicker2.Value) Then
MsgBox "入校时间比当前时间晚,请重新输入!"
DTPicker2 = ""
Exit Sub
End If
If DTPicker1 = DTPicker2 Then
MsgBox "入校时间和出生日期一样,请重新输入!"
DTPicker2 = ""
Exit Sub
End If
If DTPicker1 > DTPicker2 Then
MsgBox "出生日期大于入校日期,请重新输入!"
DTPicker1 = ""
Exit Sub
Else
End If
End sub
3.日历的使用
工程--部件--勾选 Microsoft Windows Common Controls-2 6.0
引用控件DTPicker。
Private Sub Command1_Click()
DTPicker1.Visible = True
DTPicker2.Visible = True
End Sub
Private Sub DTPicker1_CloseUp()
DTPicker1 = Format(DTPicker1, "ddddd")
DTPicker2 = Format(DTPicker1, "ddddd")
End Sub
Function batal()
'DTPicker1 = ""
'DTPicker2 = ""
End Function
Private Sub Form_Load()
batal
'DTPicker1.Visible = True
'DTPicker2.Visible = True
End sub