CurrentDb error: function marked as restricted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DDB
    New Member
    • Mar 2006
    • 5

    CurrentDb error: function marked as restricted

    I have application that runs without any problem on all PCs except one where it produced error obn currentDB line: Function or interface marked as restricted, or the function uses an Automation type not supported by VBA. All PCs have WINXP, SP2. Could not spot the problem on this "trouble" PC. Any ideas? Thank you for your time.
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    What's the code that produces the error?

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by DDB
      I have application that runs without any problem on all PCs except one where it produced error obn currentDB line: Function or interface marked as restricted, or the function uses an Automation type not supported by VBA. All PCs have WINXP, SP2. Could not spot the problem on this "trouble" PC. Any ideas? Thank you for your time.
      You can try an alternate approach for referring to the Current Database, and see what happens:
      Code:
      Dim db As DAO.Database
      
      Set db = Workspaces(0)(0)
      
      MsgBox db.Name

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32648

        #4
        I think the very least we'll need is to see the code the error occurs on.

        Comment

        • DDB
          New Member
          • Mar 2006
          • 5

          #5
          Code:
          If cn Is Nothing Then
           
           
             DBServerName = DLookup("[DBServerName]", "DBParms")
             DBName = DLookup("[DBName]", "DBParms")
             UID = DLookup("[UID]", "DBParms")
             PWD = DLookup("[PWD]", "DBParms")
           ' THIS IS A FAILED SPOT.
            Set rs = CurrentDb.OpenRecordset("SELECT Mode FROM tblMode;")
            gsMode = rs.Fields(0)
              ........
          Last edited by NeoPa; Nov 18 '09, 07:16 PM. Reason: Please use the [CODE] tags provided.

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            When apps run fine on one machine and not on another or run fine in one version and not when run under a newer version, the first thing you have to think about are missing references.

            Here are Doug Steele's detailed instructions on how to troubleshoot the problem, if you've never done it before:

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32648

              #7
              I believe OpenRecordset() is found in both DAO & ADODB flavours. Your code allows it to default, which is not good. At best it is unclear.

              I suggest you set up variables defined as DAO.Database &/or DAO.Recordset and use these in your code to be explicit.

              Comment

              Working...