Hi All
I have used this code for a few years an suddenly today an error popped up on my screen type mismatch error 13 in the code below
any help would be appreciated
Thanks
Public Function InitQRCode()
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
Dim fld As DAO.Field2
Dim db As DAO.Database
Dim strFile As String
SysCmd acSysCmdSetStatus, "Initialising QR generator..."
Set db = CurrentDb
Set rsParent = db.OpenRecordset("tblQRSheet", dbOpenDynaset)
rsParent.MoveFirst
Set rsChild = rsParent.Fields("attachment").Value
Set fld = rsChild.Fields("FileData")
strFile = TempPath() & "QRCode.xlsm"
If Dir(strFile) <> "" Then Kill (strFile)
fld.SaveToFile strFile
Set fld = Nothing
rsChild.Close
rsParent.Close
Set rsChild = Nothing
Set rsParent = Nothing
Set gxlApp = CreateObject("Excel.Application")
Set gxlWB = gxlApp.Workbooks.Open(strFile, False, False)
SysCmd acSysCmdClearStatus
End Function
I have used this code for a few years an suddenly today an error popped up on my screen type mismatch error 13 in the code below
any help would be appreciated
Thanks
Public Function InitQRCode()
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
Dim fld As DAO.Field2
Dim db As DAO.Database
Dim strFile As String
SysCmd acSysCmdSetStatus, "Initialising QR generator..."
Set db = CurrentDb
Set rsParent = db.OpenRecordset("tblQRSheet", dbOpenDynaset)
rsParent.MoveFirst
Set rsChild = rsParent.Fields("attachment").Value
Set fld = rsChild.Fields("FileData")
strFile = TempPath() & "QRCode.xlsm"
If Dir(strFile) <> "" Then Kill (strFile)
fld.SaveToFile strFile
Set fld = Nothing
rsChild.Close
rsParent.Close
Set rsChild = Nothing
Set rsParent = Nothing
Set gxlApp = CreateObject("Excel.Application")
Set gxlWB = gxlApp.Workbooks.Open(strFile, False, False)
SysCmd acSysCmdClearStatus
End Function