You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Access文件中部署二维码生成器?表单加载/卸载报错求助

Access离线生成二维码报错问题

我从论坛找到一个二维码生成器的相关内容,将其中的VBA代码复制到自己的Access文件中后出现错误。

补充信息

  • 需求:在Access中离线生成二维码,但表单加载和卸载时持续触发错误。
  • 错误截图:Access Error
  • 怀疑问题点:表单的Record Source设置

以下是我照搬原帖的表单OnLoad事件代码(路径未修改):

Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
Dim fld As DAO.Field2
Dim strExcel As String

strExcel = CurrentProject.Path & "\QRCode.xlsm"
If Dir(strExcel) = "" Then
    Set rsParent = CurrentDb.OpenRecordset("tblQRSheet", dbOpenDynaset)
    rsParent.MoveFirst
    Set rsChild = rsParent.Fields("attachment").Value
    Set fld = rsChild.Fields("FileData")
    fld.SaveToFile strExcel
    Set fld = Nothing
    rsChild.Close
    rsParent.Close
    Set rsChild = Nothing
    Set rsParent = Nothing
End If
If Dir(CurrentProject.Path & "\QRCodeImages", vbDirectory) = "" Then
    MkDir CurrentProject.Path & "\QRCodeImages"
End If

Set gxlApp = CreateObject("Excel.Application")
Set gxlWB = gxlApp.Workbooks.Open(CurrentProject.Path & "\QRCode.xlsm", False, False)

希望有人能提供解决思路,帮我让这个二维码生成器正常工作。

内容的提问来源于stack exchange,提问作者SeeeeS

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 22:48:53