• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 968
  • Last Modified:

Permission Denied

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
redpoppy
Asked:
redpoppy
  • 8
  • 4
  • 3
  • +3
1 Solution
 
Kelvin SparksCommented:
Have you tried using just
Set objOutlook = CreateObject("Outlook.Application")
Kelvin
 
 
0
 
dandrakaCommented:
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
 
MINDSUPERBCommented:
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
redpoppyAuthor Commented:
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
 
Kelvin SparksCommented:
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
 
redpoppyAuthor Commented:
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
 
Kelvin SparksCommented:
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
 
MINDSUPERBCommented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I assume the FE is on the users Terminal Services Desktop?

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

0
 
redpoppyAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
redpoppyAuthor Commented:
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
 
Greg HejlCommented:
its a locked file issue
0
 
redpoppyAuthor Commented:
Hi Greg - can you give me any ideas on how to go about finding out which file might be locked? Thanks
0
 
Kelvin SparksCommented:
Is the version of Outlook on the terminal server using Exchange behind the scenes or stand alone Outlook?
 
Kelvin
0
 
redpoppyAuthor Commented:
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
 
Greg HejlCommented:
0
 
redpoppyAuthor Commented:
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
 
redpoppyAuthor Commented:
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
 
Greg HejlCommented:
Nice workaround for the file lock issue!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 8
  • 4
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now