Thank you very much for your prompt response both of you. The thing is that I did not create this database, but based on what I was told they were getting this same error often however it would fix automatically after restarting the PC. But this is not the case now because it's been more than 3 days, and I'm still getting the same error. This form was working fine couple of days ago, I was able to update the information until it suddenly stopped working.
After the error message I click debug button and it highlights line of code which starts with set temp. I tried compact and repair the database. I also tried to create new database and import queries, forms, tables from source database, nothing fixed the issue.
Thank you very much again.
End If
'''On Error GoTo PROC_ERR
Set temp = CurrentDb.CreateQueryDef("MyQuery", "SELECT * FROM folder")
db.Execute stmt, dbFailOnError
CurrentDb.QueryDefs.Delete "MyQuery"
DoCmd.Close acForm, "folderForm", acSaveNo
Exit Sub
PROC_ERR:
MsgBox "An unexpected error has occurred. Please contact the database administrator."
Exit Sub