我不是编码人员,也不在IT中工作,但我维护营销报告的访问数据库。该数据库中包含一个VBA脚本,该脚本可循环浏览我们的报告并为每个实体创建单独的Excel文件。我已经能够复制确切的代码,并使用新表和过滤器引用将其更改为没有任何问题。
我今天尝试再次这样做,但出现错误 <template name="favoritesSidebar">
<div class="template-favorites-sidebar">
{{#if myFavorites.count}}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{_ "favorites"}}</h3>
</div>
<div class="panel-body">
<ul>
{{#each myFavorites collection="Posts"}}
<li>
<a>{{_id}}</a>
</li>
<li>
<a>{{_title}}</a>
</li>
<li>
<a>{{Post._title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
{{/if}}
</div>
</template>
。我一直在网上寻找,每个人似乎都说该错误是指不正确的字段名称或缺少引号,但我一生都无法解决。我仔细检查了表名和字段名,并尝试了许多无误的引号组合。抱歉,这是一个非常愚蠢的问题,但是我很沮丧。
"Run-time error 3061 Too few parameters expected"
这是运行代码的版本:
Private Sub Command4_Click()
Dim ExportReportName As String
Dim ExportFileName As String
Dim FilterCriteriaString As String
Dim Filter As String
Dim SQLstring As String
Dim rs As DAO.Recordset
ExportReportName = "User Retest-Partners"
SQLstring = "SELECT DISTINCT [2-5 User Retest Partners].[Owner] FROM [2-5 User Retest Partners]"
Set rs = CurrentDb.OpenRecordset(SQLstring)
If Not rs.BOF And Not rs.EOF Then
rs.MoveFirst
While (Not rs.EOF)
Filter = rs.Fields("Owner")
FilterCriteria = "[2-5 User Retest Partners].[Owner] LIKE '*" & Filter & "*'"
ExportFileName = "U:\Marketing\Reporting\User Retest Needed\Database Exports\Manager Reporting\" & Filter & ".xls"
DoCmd.OpenReport "User Retest-Partners", acViewPreview, , FilterCriteria, acHidden
DoCmd.OutputTo acOutputReport, ExportReportName, acFormatXLS, ExportFileName
DoCmd.Close acReport, ExportReportName, acSaveNo
rs.MoveNext
Wend
End If
Set rs = Nothing
End Sub