我想創建一個按鈕,按最近的同意提交日期排序如果TwoMinInt_Complete複選框未選中。到目前爲止,它給我「運行時錯誤'13':類型不匹配」並指向frm.SetRecordsource部分。我相信這是我不擅長的語法。讓我知道如果有任何問題。VBA訪問和SQL運行時錯誤'13':類型不匹配
Private Sub cmdNeeds2MinInterview_Click()
Dim frm As IExtendedForm
If TypeOf Me.Parent Is IExtendedForm Then
Set frm = Me.Parent
frm.SetRecordsource _
Filter = "Junction_ID IN SELECT Junction_ID FROM [nka_USBankVU_TwoMinInterview] WHERE [TwoMinInt_Complete] = True" & _
OrderBy = "[Consent_Filed_Date] DESC"
End If
End Sub
編輯:您的建議我把它編輯成以下內容:
frm.SetRecordsource _
Filter:=("Junction_ID IN SELECT Junction_ID FROM [nka_USBankVU_TwoMinInterview] WHERE [TwoMinInt_Complete] = True"), OrderBy:="Consent_Filed_Date DESC"
並獲得不同的錯誤:
是隻應該是'='的參數嗎?或':='? – 2013-11-26 16:33:20
與':='一起,兩個參數之間也需要逗號。 – pteranodon
frm.SetRecordsource _ Filter:=(「Junction_ID IN(SELECT Junction_ID FROM [nka_USBankVU_TwoMinInterview] WHERE [TwoMinInt_Complete] = True」)),OrderBy:=「Consent_Filed_Date DESC」 – pteranodon