Hi All
I have been putting together an access database to track documents and relating tasks.
I would like to create a button in outlook which then opens up the form for generating a new task without having to have the database open already. I have tried the following code combinations. They seem to open the database but i either get an error or the form doesn't show.
Sub NewTask()
Dim accessdb As Object
Set accessdb = CreateObject("Access.Application")
accessdb.opencurrentdatabase "X:\RegisterDatabase\DocumentTracking 2014_10_01.accdb", False
accessdb.DoCmd.OpenForm "Task Details"
accessdb.CloseCurrentDatabase
Set accessdb = Nothing
End Sub
and i created a macro which i tried to call:
Sub NewTask()
Dim accessdb As Object
Set accessdb = CreateObject("Access.Application")
accessdb.opencurrentdatabase "X:\1. Projects\1. Current\Durban (1120_0) Durban Sand Bypass Execution Stage 2\Working\Engineers\RPA\31. RegisterDatabase\1120_DSB - DocumentTracking 2014_10_01.accdb", False
accessdb.DoCmd.RunMacro "cmdOpenTask()"
accessdb.CloseCurrentDatabase
Set accessdb = Nothing
End Sub
Any idea or a better solution?
I have been putting together an access database to track documents and relating tasks.
I would like to create a button in outlook which then opens up the form for generating a new task without having to have the database open already. I have tried the following code combinations. They seem to open the database but i either get an error or the form doesn't show.
Sub NewTask()
Dim accessdb As Object
Set accessdb = CreateObject("Access.Application")
accessdb.opencurrentdatabase "X:\RegisterDatabase\DocumentTracking 2014_10_01.accdb", False
accessdb.DoCmd.OpenForm "Task Details"
accessdb.CloseCurrentDatabase
Set accessdb = Nothing
End Sub
and i created a macro which i tried to call:
Sub NewTask()
Dim accessdb As Object
Set accessdb = CreateObject("Access.Application")
accessdb.opencurrentdatabase "X:\1. Projects\1. Current\Durban (1120_0) Durban Sand Bypass Execution Stage 2\Working\Engineers\RPA\31. RegisterDatabase\1120_DSB - DocumentTracking 2014_10_01.accdb", False
accessdb.DoCmd.RunMacro "cmdOpenTask()"
accessdb.CloseCurrentDatabase
Set accessdb = Nothing
End Sub
Any idea or a better solution?