这段代码有错?
Private Sub CmdInq_Click()
Dim stsql As String
stsql = "select * from 寄件明细表 where [部门] like '%" & Me.TxtDep & "%' and [寄件人] like '%" & Me.TxtPer & "%' and [快递机构] like '%" & Me.TxtVend & "%' and [目的地] like '%" & Me.TxtGo & "%'"
If IsNull(Me.TxtDate) Then
stsql = stsql & " and [日期] between '1970-01-01' and '2050-12-31'"
Else
stsql = stsql & " and [日期] = '" & Me.TxtDate & "'"
End If
Me.寄件明细表子窗体.Form.RecordSource = stsql
End Sub