我在查询结果中填写访问表单时遇到错误,但它给了我“此表单或报表上指定的recordsource [查询此处]不存在
这是我的代码:
Me.RecordSource = "SELECT Division, Station, EmployeeNumber, BranchCode, AccountNumber, LedgerSetNumber, EmployeeName, EffectDate, TermDate, Amount, BillingType, DateBilled, PolicyNumber, BillingStatus, UpdateStatus, DateUpdated, SequenceNumber FROM DepEdTempBilling WHERE (UpdateStatus<>'Billed') ORDER BY Division, Station, EmployeeNumber, BranchCode, AccountNumber, LedgerSetNumber, EmployeeName"
截图:
答案 0 :(得分:0)
你的逻辑是正确的。出于某种原因,这是行不通的。我用我的代码做了同样的事情。在这里,希望这会有所帮助。
Me.RecordSource = "SELECT tblQuoteMaster.[Quote Number], tblQuoteMaster.Status, tblQuoteMaster.Prefix, tblQuoteMaster.[Rev Number], tblQuoteMaster.[AWC Rep], tblQuoteMaster.Estimator, tblQuoteMaster.Customer, CUSLST.Name1 AS Company, tblQuoteMaster.CustomerID, tblQuoteMaster.[Approx Value], tblQuoteMaster.Currency, tblQuoteMaster.Decription, tblQuoteMaster.[Date Received], tblQuoteMaster.[Date Sent], tblQuoteMaster.[Follow Up Date], tblQuoteMaster.[Contact for Quote], tblQuoteMaster.ProductCode FROM (tblQuoteMaster INNER JOIN CUSLST ON tblQuoteMaster.CustomerID = CUSLST.[Account Code]) INNER JOIN tblContact ON CUSLST.[Account Code] = tblContact.[Customer Number] WHERE (" & strSQL & ");"
我看到有些人将他们的记录集分配给RecordSource。这总会给我你的错误。例如:
Dim rcd As RecordSet
Set rcd = db.OpenRecordset("SELECT.....")
Me.RecordSource = rcd.Name
答案 1 :(得分:-1)
重新制作了表格和表格并进行了测试,当属性表(访问窗口不是VBA编辑器)表格/记录来源:“[查询此处]”中清除此行并重试时,会发生此错误,如果这不起作用,请尝试使用此语句的干净新表单。命令本身和SQL似乎没问题。