Microsoft KB Archive/115976

= How to Modify VISDATA Sample to Work with Compatibility Layer =

Article ID: 115976

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q115976



NOTE: To run the code in this article, you must own Microsoft Access version 2.0 and the Microsoft Access 2.0/Visual Basic 3.0 Compatibility Layer in addition to Visual Basic version 3.0.



SUMMARY
The VISDATA sample program rewrites its .INI file each time you run it, and it generates an .INI file specific to Microsoft Access version 1.1. To update the VISDATA sample so that it writes an .INI file specific to the Microsoft Access version 2.0 database engine, make the changes listed in this article.

Please see the following article in the Microsoft Knowledge Base for instructions on how to obtain the Compatibility Layer:

113951 How to Obtain & Distribute the Compatibility Layer



MORE INFORMATION
 Start a new project in Visual Basic. Form1 is created by default. Load the VISDATA.MAK sample application located in the \VB\SAMPLES\VISDATA directory. Select the VDMDI.FRM from the project window, and bring this form into view. Press the F7 key to view the code, and find the MDIForm_Load event procedure in VDMDI.FRM.  Make the following modifications to the code. In the load event, look for the following comment: 'write ISAM entries in INI file just in case Immediately following this comment, you'll find a series of lines of the following form: x = OSWritePrivateProfileString("Installable ISAMs", ... The third argument in each of these calls is a file name. Modify the name so that it contains the number 200 instead of 110. For example, change XBS110.DLL into XBS200.DLL. Also, add an extra line to support Paradox 4.X. The resulting code should look like the following except that each pair of lines will appear as one, single line in Visual Basic:   x = OSWritePrivateProfileString("Installable ISAMS", "Paradox 3.X", "PDX200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "Paradox 4.X", "PDX200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "dBASE III", "XBS200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "dBASE IV", "XBS200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "FoxPro 2.0", "XBS200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "FoxPro 2.5", "XBS200.DLL", "VISDATA.INI")  x = OSWritePrivateProfileString("Installable ISAMS", "Btrieve", "BTRV200.DLL", "VISDATA.INI") Add the following entries to support Paradox on a network:   x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxUserName", "Bill", "VISDATA.INI")  ' NOTE: Bill is the machine name (any name you want to give it)   x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxNetPath", "c:\vb\prdx", "VISDATA.INI")  x = OSWritePrivateProfileString("Paradox ISAM", "ParadoxNetStyle", "4.x", "VISDATA.INI") '** note: 4.x works with 3.x and 4.x NetStyles  x = OSWritePrivateProfileString("Paradox ISAM", "CollatingSequence", "Ascii", "VISDATA.INI") Further down in the code (about half way through the Sub procedure), you will see this line:   If PrefOpenOnStartup.Checked = True Then Add an extra If statement to support the shortcut key for Paradox 4.x to make the code look like this:    If PrefOpenOnStartup.Checked = True Then      If gstDataType = "MS Access" Then         SendKeys "%FOM"      ElseIf gstDataType = "dBASE III" Then         SendKeys "%FOD"      ElseIf gstDataType = "dBASE IV" Then         SendKeys "%FOA"      ElseIf gstDataType = "FoxPro 2.0" Then         SendKeys "%FOF"      ElseIf gstDataType = "FoxPro 2.5" Then         SendKeys "%FOX"      ElseIf gstDataType = "Paradox 3.X" Then         SendKeys "%FOP"      ElseIf gstDataType = "Paradox 4.X" Then   '** new addition         SendKeys "%FOR"   '** 'r' in the word Paradox is shortcut      ElseIf gstDataType = "Btrieve" Then         SendKeys "%FOB" ElseIf gstDataType = "ODBC" Then SendKeys "%BOB" End If  End If                          Add new lines of code to the OpenLocalDB procedure in the VDMDI.FRM form's general section. Look for the Select Case statement, and modify it to look like this: Select Case gstDataType Case "MS Access" CMD1.Filter = "Access DBs (*.mdb)|*.mdb|All Files (*.*)|*.*" CMD1.DialogTitle = "Open MS Access Database" Case "dBASE III" CMD1.Filter = "dBASE III DBs (*.dbf)|*.dbf" CMD1.DialogTitle = "Open dBASE III Database" Case "dBASE IV" CMD1.Filter = "dBASE IV DBs (*.dbf)|*.dbf" CMD1.DialogTitle = "Open dBASE IV Database" Case "FoxPro 2.0" CMD1.Filter = "FoxPro DBs (*.dbf)|*.dbf" CMD1.DialogTitle = "Open FoxPro 2.0 Database" Case "FoxPro 2.5" CMD1.Filter = "FoxPro DBs (*.dbf)|*.dbf" CMD1.DialogTitle = "Open FoxPro 2.5 Database" Case "Paradox 3.X"        CMD1.Filter = "Paradox DBs (*.db)|*.db" CMD1.DialogTitle = "Open Paradox 3.X Database" Case "Paradox 4.X"            '** newly added for Paradox 4.x         CMD1.Filter = "Paradox DBs (*.db)|*.db" CMD1.DialogTitle = "Open Paradox 4.X Database" Case "Btrieve" CMD1.Filter = "Btrieve DBs (FILE.DDF)|FILE.DDF" CMD1.DialogTitle = "Open Btrieve Database" End Select Further down in the code there is another Select Case statement. Make it look like this: Select Case gstDataType Case "dBASE III" Connect = "dBASE III" DataBaseName = StripFileName(gstDBName) Case "dBASE IV" Connect = "dBASE IV" DataBaseName = StripFileName(gstDBName) Case "FoxPro 2.0" Connect = "FoxPro 2.0" DataBaseName = StripFileName(gstDBName) Case "FoxPro 2.5" Connect = "FoxPro 2.5" DataBaseName = StripFileName(gstDBName) Case "Paradox 3.X"        Connect = "Paradox 3.X"         DataBaseName = StripFileName(gstDBName) Case "Paradox 4.X"              '** newly added Connect = "Paradox 4.X"        DataBaseName = StripFileName(gstDBName) Case "Btrieve" Connect = "Btrieve;" DataBaseName = gstDBName Case Else Connect = "" DataBaseName = gstDBName End Select </li> Choose Menu Design Window from the Window menu, while the VDMDI.FRM is showing. A code window cannot be showing or the Menu Design Window option is grayed-out.</li>  Select the &Btrieve... line under the &Open DataBase... section, and choose the Insert button. Type Pa&radox 4.X... as the caption and Open_paradox4x as the name. Then add the following code to the Open_paradox4x_Click event procedure: Sub Open_paradox4X_Click gstDataType = "Paradox 4.X"     OpenLocalDB False End Sub </li>  Select the &Btrieve... line under the &New... section and choose the Insert button. Enter Pa&radox 4.X... as the caption and New_paradox4x as the name. Then add the following code to the New_paradox4x_Click event procedure: Sub New_paradox4X_Click gstDataType = "Paradox 4.X"     NewLocalISAM End Sub </li></ol>

The VISDATA sample application will now work with the Microsoft Access version 2.0 database engine.

NOTE: If you run VISDATA without making the changes outlined in this article, you will receive the following error message if you try to connect to a dBASE file:

3170: Cannot find installable ISAM.

Additional query words: 3.00

Keywords: KB115976

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.