|
不知道是不是这个意思
Private Sub Command2_Click()
Dim rs As New ADODB.Recordset
Dim qdf As DAO.QueryDef
Dim strSQL As String
Dim strWhere As String
If Not IsNull(Me.Combo0) Then
strWhere = "姓名='" & Me.Combo0 & "'"
strSQL = "select * from a where " & strWhere
Else
strSQL = "select * from a"
End If
Set qdf = CurrentDb.QueryDefs("b")
qdf.SQL = strSQL
DoCmd.OpenQuery "b"
qdf.Close
With rs
.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
Do While Not .EOF
If .Fields("结束日期") < Date Then
MsgBox .Fields(0) & "--" & .Fields(1) & "--" & "已过期"
Else
MsgBox .Fields(0) & "--" & .Fields(1) & "--" & "没过期"
End If
.MoveNext
Loop
.Close
End With
Set rs = Nothing
Set qdf = Nothing
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|