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.
CurrentDb error: function marked as restricted
Collapse
X
-
You can try an alternate approach for referring to the Current Database, and see what happens: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.
Code:Dim db As DAO.Database Set db = Workspaces(0)(0) MsgBox db.Name
Comment
-
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) ........Comment
-
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
-
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
Comment