Solved

Permission Denied

Posted on 2010-09-07
20
879 Views
Last Modified: 2012-05-10
Hi Experts,

This question relates to an Access 2003 database running on Windows server 2003. The back end resides on the server, the users (max. 6) have their own copy of the FE and access the BE via Terminal Services.

The following line of code in a module is sometimes causing "Permission Denied" (Error 70) errors:
Set objOutlook = CreateObject("Outlook.Application", "localhost")

Most of the time it works fine - it's in a routine that sends all e-mails from the database using Outlook automation. I can't see any pattern to this error and it can happen to any user on any computer. Any ideas gratefully received
0
Comment
Question by:redpoppy
  • 8
  • 4
  • 3
  • +3
20 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
Comment Utility
Have you tried using just
Set objOutlook = CreateObject("Outlook.Application")
Kelvin
 
 
0
 
LVL 8

Expert Comment

by:dandraka
Comment Utility
if you are on windows vista, check your security rights.

Go to \Windows\System32\inetsrv\config directory. Right-click to open the config
files' security property. Verify your logon admin account has permission on
them first. Then please click Advanced button, take ownership of these
files in Owner tab.

0
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility
redpoppy,

Below are reasons to get (Error 70). This might help to solve the issue.


Visual Basic for Applications Reference
Permission denied (Error 70)


An attempt was made to write to a write-protected disk or to access a locked file. This error has the following causes and solutions:

You tried to open a write-protected file for sequential Output or Append.
Open the file for Input or change the write-protection attribute of the file.

You tried to open a file on a disk that is write-protected for sequential Output or Append.
Remove the write-protection device from the disk or open the file for Input.

You tried to write to a file that another process locked.
Wait to open the file until the other process releases it.

You attempted to access the registry, but your user permissions don't include this type of registry access.
On 32-bit Microsoft Windows systems, a user must have the correct permissions for access to the system registry. Change your permissions or have them changed by the system administrator.


Sincerely,

Ed
0
 

Author Comment

by:redpoppy
Comment Utility
Hi - Thanks for replies, please see my comments below:

Kelvin - I'll try that out and see what happens

dandraka - it's on Windows 2003 Server

Ed - Thanks for that, but  I don't know how to check if any of the items in your list relate to the error we're getting on that specific line of code - can you give me any help on that?
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
Comment Utility
You say that the FE resides on each users PC, This would mean that this code is running on the PC - only getting data from the server.
I've used the setting described above without the localhost before without issues
0
 

Author Comment

by:redpoppy
Comment Utility
kelvin - I'm not sure why "localhost" was put in - why not the name of the server, if it was needed at all? I'll try a test and see if it works without that param. Thanks for helping
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
Comment Utility
I checked back on a number of my systems that have made extensive use of this and none have used that aparameter and to the best of my knowledge non have returned an error.
 
Kelvin
0
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility
redpoppy,

"Most of the time it works fine"

As part of your question above, I suspect the third on the list I posted as the cause of the permission error:
You tried to write to a file that another process locked.
Wait to open the file until the other process releases it.

As we know that access has a locking file, and if user permissions are not properly set into the BE, then "permission denied error" possibly occurs.

Just a thought.

Ed

0
 
LVL 84
Comment Utility
I assume the FE is on the users Terminal Services Desktop?

What version of Outlook are you running on the TS box?

0
 

Author Comment

by:redpoppy
Comment Utility
Hi LSM - yes, FE's are on users Terminal Services Desktop. Outlook version is 2003 on the server - accessed via an "Exchange Clone" called Outlook Folders that allows the server PST file to be shared.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 84
Comment Utility
Try switching from CreateObject to GetObject. GetObject will create one if needed, but it can use an in-process one if it already exists. the syntax is the same regardless.
0
 

Author Comment

by:redpoppy
Comment Utility
Hi LSM, I tried your suggestion but it's giving me a run-time error 429: "ActiveX component can't create object" on the GetObject line.
0
 
LVL 13

Expert Comment

by:Greg Hejl
Comment Utility
its a locked file issue
0
 

Author Comment

by:redpoppy
Comment Utility
Hi Greg - can you give me any ideas on how to go about finding out which file might be locked? Thanks
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
Comment Utility
Is the version of Outlook on the terminal server using Exchange behind the scenes or stand alone Outlook?
 
Kelvin
0
 

Author Comment

by:redpoppy
Comment Utility
Outlook is on the server, shared via "Outlook Folders" - a piece of software that allows sharing of the PST file (much cheaper option than Exchange).
0
 
LVL 13

Expert Comment

by:Greg Hejl
Comment Utility
0
 

Author Comment

by:redpoppy
Comment Utility
Sorry for delay, I've been trying to get our technical people to have a look at the links posted by Greg - those solutions are abit beyond my level of understanding. I think it's going to take a few days for them to monitor what might be happening, so I'd like to leave this question open until the end of the week.
0
 

Accepted Solution

by:
redpoppy earned 0 total points
Comment Utility
OK, it looks like I've found a solution from a suggestion made by our technical agency - they thought that it was possible the error was happening when different users were trying to send e-mails at the same time. I changed the error routine in the affected module to trap for "error 70" (permission denied) wait for 2 seconds then re-try the CreateObject - see the code below. Since doing this there haven't been any "Permission Denied" errors, so I'm going to ask admin to withdraw this question. Thanks for all the suggestions, much appreciated.


email_object_Err:
'14/09/10: the following code was put in to try and find a way around "Permission Denied" errors which may be caused by simultaneous e-mail sending
'This will retry twice. Amend iRetry as required.
If Err.Number = 70 And iRetry <= 2 Then
    iRetry = iRetry + 1
    'wait duration 2 seconds
    dtmContinue = DateAdd("s", 2, Now)
    Do While Now < dtmContinue
        DoEvents
    Loop
    GoTo Retry_Outlook   'go back to re-try the CreateObject
Else
    Call ErrorLog(Err.Description, Err.Number, Erl, "email_object", True)
    ' now raise the same error in the calling routine, for "bubble up" error handling
    Err.Raise sys_last_err
    Resume email_object_Exit
End If
0
 
LVL 13

Expert Comment

by:Greg Hejl
Comment Utility
Nice workaround for the file lock issue!
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Outlook Free & Paid Tools
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now