jediderek
06-08-2017, 10:48 AM
So I have a button in outlook that saves a email, then copies the file's name, and file path to an "Access" database. It does complete the function, but what ends up happening is after the button is clicked, Outlook freezes up(including vba editor). About 30 seconds later, a windows msg box says "Microsoft access has stopped working" then it says "Microsoft access is restarting" then it launches Access. I looked into the table and the record was added properly.
I tried it while Access was opened and tried it with it closed, same resort. Whats weird is if you look at the code below, I added at the very end of the function, debug.print done, to say it finished. So after I press the button, in vba editor, it does print it out before outlook starts freezing. Any help would be appreciated
'open up an access database and insert a new record, specifically the filename and path
Set accessApp = New Access.Application
strSQL = "INSERT INTO tbleFiles(FileName,FilePath,FileFormat,FileType_ID) VALUES ('" & sName & "','" & sPath & "','" & ext & "','" & 1 & "');"
Call accessApp.OpenCurrentDatabase("C:\Users\Derek\Documents\SmallProjecttest.accdb")
accessApp.Visible = False
accessApp.CurrentProject.Connection.Execute (strSQL)
accessApp.Quit
Debug.Print "Done"
I tried it while Access was opened and tried it with it closed, same resort. Whats weird is if you look at the code below, I added at the very end of the function, debug.print done, to say it finished. So after I press the button, in vba editor, it does print it out before outlook starts freezing. Any help would be appreciated
'open up an access database and insert a new record, specifically the filename and path
Set accessApp = New Access.Application
strSQL = "INSERT INTO tbleFiles(FileName,FilePath,FileFormat,FileType_ID) VALUES ('" & sName & "','" & sPath & "','" & ext & "','" & 1 & "');"
Call accessApp.OpenCurrentDatabase("C:\Users\Derek\Documents\SmallProjecttest.accdb")
accessApp.Visible = False
accessApp.CurrentProject.Connection.Execute (strSQL)
accessApp.Quit
Debug.Print "Done"