Creating a task in Outlook from Access

B

Blogd_Node

Hi,

I'd really appreciate some help with this...

I'm wanting to write a new TASK to Outlook-2003 from a form in Access-2003.

Have tried both Early and Late binding... (see dims)
Code crashes (Runtime error 91) at line marked "<<<<<error>>>>" (see below.)
whether Outlook is running or not...

Any suggestions greatly appreciated.

Many thanks

David
======================================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Outlook.Application 'Early Binding
Dim myItem As Outlook.TaskItem 'Early Binding
Dim objSafeTaskItem As Object 'Early Binding
Dim myNS As Outlook.NameSpace 'Early Binding

'Dim objOL As Object 'Late Binding
'Dim myItem As Object 'Late Binding
'Dim objSafeTaskItem As Object 'Late Binding
'Dim myNS As Object 'Late Binding

Dim blnOlRunning As Boolean
Dim timeX As String
Dim strVia As String
Dim strReg As String

'Save the local Access record.
Me.Refresh

'Check if Outlook is already running by
'looking for an error when opening
On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is NOT running, then
If Err.Number = 429 Then
Err.Clear
'open an instance of Outlook
Set objOL = CreateObject("Outlook.application")
End If

'Reset error trap
On Error GoTo 0

Set myNS = objOL.GetNamespace("MAPI") '<<<<error
myNS.Logon

' If there is a date set
If Len(Me!ChaseDateCalendar & "") > 0 Then

'Set alert time
timeX = "09:00:00"
strVia = Trim(Me![cmbContactBy]) & ""

(code continues.... snipped for brevity...)
 
K

Ken Slovak - [MVP - Outlook]

Check to see if objOL Is Nothing. I bet you're running some script stopper
program from an A-V package or software firewall that's preventing
CreateObject or GetObject from running.




Blogd_Node said:
Hi,

I'd really appreciate some help with this...

I'm wanting to write a new TASK to Outlook-2003 from a form in
Access-2003.

Have tried both Early and Late binding... (see dims)
Code crashes (Runtime error 91) at line marked "<<<<<error>>>>" (see
below.)
whether Outlook is running or not...

Any suggestions greatly appreciated.

Many thanks

David
======================================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Outlook.Application 'Early Binding
Dim myItem As Outlook.TaskItem 'Early Binding
Dim objSafeTaskItem As Object 'Early Binding
Dim myNS As Outlook.NameSpace 'Early Binding

'Dim objOL As Object 'Late Binding
'Dim myItem As Object 'Late Binding
'Dim objSafeTaskItem As Object 'Late Binding
'Dim myNS As Object 'Late Binding

Dim blnOlRunning As Boolean
Dim timeX As String
Dim strVia As String
Dim strReg As String

'Save the local Access record.
Me.Refresh

'Check if Outlook is already running by
'looking for an error when opening
On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is NOT running, then
If Err.Number = 429 Then
Err.Clear
'open an instance of Outlook
Set objOL = CreateObject("Outlook.application")
End If

'Reset error trap
On Error GoTo 0

Set myNS = objOL.GetNamespace("MAPI") '<<<<error
myNS.Logon

' If there is a date set
If Len(Me!ChaseDateCalendar & "") > 0 Then

'Set alert time
timeX = "09:00:00"
strVia = Trim(Me![cmbContactBy]) & ""

(code continues.... snipped for brevity...)
 
B

Blogd_Node

Hi Ken,

Thanks for the reply.
objOL is nothing.
Disabled NAV and ZoneAlarm, but no difference...

?? Any further clues ??

Thanks -
David


"Ken Slovak - wrote
Check to see if objOL Is Nothing. I bet you're running some script stopper
program from an A-V package or software firewall that's preventing
CreateObject or GetObject from running.



Blogd_Node said:
Hi,

I'd really appreciate some help with this...

I'm wanting to write a new TASK to Outlook-2003 from a form in
Access-2003.

Have tried both Early and Late binding... (see dims)
Code crashes (Runtime error 91) at line marked "<<<<<error>>>>" (see
below.)
whether Outlook is running or not...

Any suggestions greatly appreciated.

Many thanks

David
======================================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Outlook.Application 'Early Binding
Dim myItem As Outlook.TaskItem 'Early Binding
Dim objSafeTaskItem As Object 'Early Binding
Dim myNS As Outlook.NameSpace 'Early Binding

'Dim objOL As Object 'Late Binding
'Dim myItem As Object 'Late Binding
'Dim objSafeTaskItem As Object 'Late Binding
'Dim myNS As Object 'Late Binding

Dim blnOlRunning As Boolean
Dim timeX As String
Dim strVia As String
Dim strReg As String

'Save the local Access record.
Me.Refresh

'Check if Outlook is already running by
'looking for an error when opening
On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is NOT running, then
If Err.Number = 429 Then
Err.Clear
'open an instance of Outlook
Set objOL = CreateObject("Outlook.application")
End If

'Reset error trap
On Error GoTo 0

Set myNS = objOL.GetNamespace("MAPI") '<<<<error
myNS.Logon

' If there is a date set
If Len(Me!ChaseDateCalendar & "") > 0 Then

'Set alert time
timeX = "09:00:00"
strVia = Trim(Me![cmbContactBy]) & ""

(code continues.... snipped for brevity...)
 
K

Ken Slovak - [MVP - Outlook]

No, I'd look for anything that might be running a script stopper, those are
the classic symptoms.

Norton can be as hard as a virus to disable, and that would be my #1 suspect
in any case. Make sure it really is disabled and that the script stopper in
it isn't running.
 
B

Blogd_Node

SOLVED -ANSWER- FIXED -Found -solution
and various other keywords :)

Hi Ken,

I used REGMON to check registry calls.
Instead of "outlook.application" which was failing,
the call should be to "outlook.application.11"
(HKCR\Outlook.Application.11)

Changing --------------------------------
Set objOL = GetObject(, "Outlook.Application")
and
Set objOL = CreateObject("Outlook.application")

TO---------------------------------------
Set objOL = GetObject(, "Outlook.Application.11")
and
Set objOL = CreateObject("Outlook.application.11")

All now works !
:)

Now, anyone like to explain why ?

Many thanks

David

=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top