Data Forms Designer Doesn't Recognize MS Access 7.0 Database

Last reviewed: March 10, 1997
Article ID: Q148266
4.00 WINDOWS kbusage

The information in this article applies to:

  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 32-bit only, for Windows, version 4.0

SYMPTOMS

DataForms Designer under Windows 95 does not recognize a Microsoft Access 7.0 database and generates the error: "Can't open DataBase "c:\xxx.mdb" It may not be a Database or the file may be corrupt".

Steps to Reproduce the Problem

  1. Start Visual Basic or from the File menu, choose New Project (ALT, F, N).

  2. From the Add-ins menu select Data Form Designer. If Data Form Designer is not available choose Add-in-manager and add it to the menu.

  3. After selecting Data Form Designer click on the Opendatabase button on Data form designer dialog and select the Northwind.mdb from the samples directory of the Access application. The error message will display at this point.

CAUSE

In the dfd.frm which is in the data wizard sample, there is a subroutine

Sub cmdOpenDB_Click which includes a case statement that incorrectly has a
dlgDBOpen.Flags setting of &H4 or the constant value for cdlOFNHideReadOnly. The dlgDBOpen.Flags needs to be assigned the cdlOFNExplorer constant value which can be located in the object browser.

RESOLUTION

  1. Start VB4-32 and load the dfd.vbp project from the samples\datawiz directory of VB4-32.

  2. View the code of dfd.frm file and locate the cmdOpenDB_Click procedure.

  3. Change the value assigned to the dlgDBOpen.Flags setting which is shown below with the incorrect setting.

    With dlgDBOpen

             .FilterIndex = 1
             .FileName = msDBName  '""
             .CancelError = True
             .Flags = &H4
             .Action = 1
       End With
    
    
To change the constant value for dlgDBOpen.Flags:

  1. Highlight the &H4 value.

  2. Press the F2 key to bring up the Object Browser.

  3. From the Libraries/Projects drop down list box Select "MSComDlg - Microsoft Common Dialog Control."

  4. Under Classes/Modules, select FileOpenConstants.

  5. Under Methods/Properties, select cdlOFNExplorer, then click the Paste button.

  6. From the VB file menu, choose Make Ole Dll File, and save to the samples\datawiz directory of VB4-32.

  7. In a new project, detach then reattach the DataForm Designer to the Add- ins menu. It will now recognize a Microsoft Access 7.0 database.


Additional reference words: 4.00 vb4win vb432
KBCategory: kbusagekbtool
KBSubcategory: APrgOther


Keywords : APrgOther kbtool kbusage
Version : 4.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.