The information in this article applies to:
SYMPTOMS
Executing the SetDefaultWorkspace command with invalid parameters does not
generate any error until a Database is opened or a Workspace is created.
However, in Visual Basic version 3.0, this error is generated by the
SetDefaultWorkspace statement. CAUSEIn Visual Basic version 3.0, the SetDefaultWorkspace command immediately attempted to verify the parameters passed to it for the current session. In Visual Basic 4.0, the Username and Password parameters passed to the SetDefaultWorkspace statement set properties on the DBEngine object. These properties are not applied until a Workspace is created or a Database is opened. RESOLUTIONThe SetDefaultWorkspace statement is included in Visual Basic version 4.0 for compatibility with earlier versions. For Visual Basic version 4.0 applications, Microsoft recommends that you use the properties of the Workspace object instead. See the "Example Resolution" section near the end of this article for an example. STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce BehaviorTo reproduce the SetDefaultWorkspace error, you must have a password protected Microsoft Access database. Visual Basic version 4.0 does not ship with a secure database. If you have Microsoft Access, you can add security to a database by opening the database and choosing Change Password from the Security menu.
In Visual Basic version 4.0, the error does not occur until you attempt to open a secure database. Replace the above code with the following. NOTE: To run this sample you must have the Microsoft DAO 2.5/3.0 Compatibility Library selected in the Tools References dialog.
Example ResolutionThe implication here is that you may need to move your error trapping code if you are currently trapping for errors on the SetDefaultWorkspace statement.To update your code to use the correct Microsoft DAO 3.0 syntax, replace the above version 4.0 example with the following:
Error trapping may have to be moved in order to accommodate the multiple
Workspace capability of Visual Basic version 4.0. Error trapping should be
set up to trap on the Opendatabase or CreateWorkspace methods.
Additional query words: 4.00 vb4win vb4all
Keywords : APrgDataAcc |
Last Reviewed: September 17, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |