如何将 Microsoft Access 表单中的单个记录打印到报告中
我对 Access 和 VB 非常陌生,我即将打印特定记录..但我在使用此代码时遇到错误:
Private Sub printEksternAVR_Click()
DoCmd.OpenReport [Report_AVR Ekstern], acViewPreview, , [Report_AVR Ekstern].Rapport_nr = Forms!Form_AVR
End Sub
我的报告名称是 AVR Ekstern,主键是 Rapport nr,我单击按钮的表单并在AVR中查看记录,
我认为我一路上误解了一些东西,所以我真的希望有人可以帮助我?
i'm very new to Access and VB, and im about to print a specific record.. but im getting an error with this code:
Private Sub printEksternAVR_Click()
DoCmd.OpenReport [Report_AVR Ekstern], acViewPreview, , [Report_AVR Ekstern].Rapport_nr = Forms!Form_AVR
End Sub
My reports name is AVR Ekstern, and the prime key is Rapport nr and the form im clicking the button and viewing the record in, is AVR
i think i misunderstood something alon the way, so i really hope someone can help me out here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WHERE 条件是一个字符串。您需要将该参数用引号引起来。假设 Rapport_nr 是一个整数:
呃等等,您还缺少 Forms!Form_AVR 中应该用作查询字符串中的键值占位符的字段。您只是在那里引用表格本身。也在末尾添加该表单字段名称,无论哪个字段包含您要查找的键值。
请参阅:此 MSDN 页面了解更多信息细节。
The WHERE condition is a string. You'll need to wrap that parameter in quotes. Assuming
Rapport_nr
is an Integer:Er wait, you're also missing the field in Forms!Form_AVR which you're supposed to use as the key value placeholder in the query string. You're just referencing the form itself there. Add that form field name at the end there too, whichever field holds the key value you're looking up.
See: this MSDN page for more details.