0
我需要通過要求用戶輸入帳號和日期範圍來驗證帳戶在特定時間段內完成的操作,但每次運行時都會出現「類型不匹配「按日期顯示帳戶操作
下面是代碼:
Private Sub cmdSearch_Click()
Call search
End Sub
Sub search()
Dim strCriteria, strCount, task As String
Me.Refresh
If IsNull(Me.compte_hist) Or IsNull(Me.date_deb) Or IsNull(Me.date_fin) Then
MsgBox "s'il vous plaît assurez-vous que tous les champs sont remplis", vbInformation, "Date Range Required"
Me.compte_hist.SetFocus
Else
strCriteria = "([Date_operation]>= #" & Me.date_deb & "# And [Date_operation] <= #" & Me.date_fin & "#)"
strCount = "[Compte]=#" & Me.compte_hist & "#"
task = "select * from Operations where Operations (" & strCriteria & ")" And " (" & strCount & ") order by [Date_operation]"
DoCmd.ApplyFilter task
End If
End Sub
友情提示,'strCriteria'和'strCount'的變體。請參閱[doc](http://stackoverflow.com/documentation/vba/877/declaring-variables/2957/dim#t=201607281239547850873) – litelite