Help needed to make access 2010 database work with runtime module. (1 Viewer)

lasse

New member
Local time
Today, 23:52
Joined
Mar 29, 2013
Messages
8
Hi all.
I've just finished an access 2010 database that works ok in my fullversion Access 2010. When I run the Packet solution wizard it looks ok, but when I install the result on another PC (xp, vista, 7, 8) I get this message:
'A potential security consern has been identified .....' and when I press ok, runtime opens without the base. Just two tabs: File (print, Privacy Options, Exit and Save as Adobe PDF) and Acrobat (Create PDF aso.....). I've been surfing the net for explanations, but all I find makes me even more confused than before. I hope anyone can help me with a 'cookbook' and bear in mind that last time I worked with access it was Access 97 some 15 years ago.

Hopefully

Lasse
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:52
Joined
Feb 19, 2002
Messages
42,976
To solve the problem, you will need to create "trusted" directories on each user's PC which you can't do with the runtime. You can do this by modifying the registry directly or if you use an installer such as SageKey, it will create the registry keys for you. Alternatively, if you have IT support at your company, they can usually create something they can "push" to each user to set the keys for you. The following code "may" work.
Code:
Public Function AddTrustedLocation()
On Error GoTo err_proc
'WARNING:  THIS CODE MODIFIES THE REGISTRY
'sets registry key for 'trusted location'

  Dim intLocns As Integer
  Dim i As Integer
  Dim intNotUsed As Integer
  Dim strLnKey As String
  Dim reg As Object
  Dim strPath As String
  Dim strTitle As String
  
  strTitle = "Add Trusted Location"
  Set reg = CreateObject("wscript.shell")
  strPath = CurrentProject.Path

  'Specify the registry trusted locations path for the version of Access used
  strLnKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\" & Format(Application.Version, "##,##0.0") & _
             "\Access\Security\Trusted Locations\Location"

On Error GoTo err_proc0
  'find top of range of trusted locations references in registry
  For i = 999 To 0 Step -1
      reg.RegRead strLnKey & i & "\Path"
      GoTo chckRegPths        'Reg.RegRead successful, location exists > check for path in all locations 0 - i.
checknext:
  Next
  MsgBox "Unexpected Error - No Registry Locations found", vbExclamation
  GoTo exit_proc
  
  
chckRegPths:
'Check if Currentdb path already a trusted location
'reg.RegRead fails before intlocns = i then the registry location is unused and
'will be used for new trusted location if path not already in registy

On Error GoTo err_proc1:
  For intLocns = 1 To i
      reg.RegRead strLnKey & intLocns & "\Path"
      'If Path already in registry -> exit
      If InStr(1, reg.RegRead(strLnKey & intLocns & "\Path"), strPath) = 1 Then GoTo exit_proc
NextLocn:
  Next
  
  If intLocns = 999 Then
      MsgBox "Location count exceeded - unable to write trusted location to registry", vbInformation, strTitle
      GoTo exit_proc
  End If
  'if no unused location found then set new location for path
  If intNotUsed = 0 Then intNotUsed = i + 1
  
'Write Trusted Location regstry key to unused location in registry
On Error GoTo err_proc:
  strLnKey = strLnKey & intNotUsed & "\"
  reg.RegWrite strLnKey & "AllowSubfolders", 1, "REG_DWORD"
  reg.RegWrite strLnKey & "Date", Now(), "REG_SZ"
  reg.RegWrite strLnKey & "Description", Application.CurrentProject.Name, "REG_SZ"
  reg.RegWrite strLnKey & "Path", strPath & "\", "REG_SZ"
  
exit_proc:
  Set reg = Nothing
  Exit Function
  
err_proc0:
  Resume checknext
  
err_proc1:
  If intNotUsed = 0 Then intNotUsed = intLocns
  Resume NextLocn

err_proc:
  MsgBox Err.Description, , strTitle
  Resume exit_proc
  
End Function
 

Steve@trop

Registered User.
Local time
Today, 15:52
Joined
May 10, 2013
Messages
148
Are you sure the version of the runtime you are using is 2010? My limited experience so far is that if the database is created with Access 2010 you need the Access 2010 runtime to open it. Had a similar problem a week or so ago. Created database in 2010, Access 2007 runtime would not open it. Removed 2007 runtime and installed 2010 runtime and all is well.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:52
Joined
Feb 19, 2002
Messages
42,976
A2007 and A2010 use the same file format so databases created witn a2010 can be read by A2007 PROVIDED you haven't used any A2010 objects. Calculated fields are the biggest culpret but there are a couple of others.
 

Steve@trop

Registered User.
Local time
Today, 15:52
Joined
May 10, 2013
Messages
148
Thanks for clarifying for me Pat! All I know is what worked for me. I had no idea why. :)

I don't know what 2010 feature I was using that caused the 2007 runtime to not work. I even tried saving the database in .mdb and it still wouldn't open until I updated the runtime to 2010.

Steve
 

Users who are viewing this thread

Top Bottom