Open dBASE III-DB with non-standard file extension in VB5 
Author Message
 Open dBASE III-DB with non-standard file extension in VB5

Hi,
I have a dBase III Database with only one table:
c:\Folder\Dbase\Something.mdb

Yes I know '.mdb' - it looks like a MS-Access-Database - but it isn't.
It's not my fault, and I cannot change this...

Now my question:
How do I have to declare the OpenDatabase and OpenRecordset commands?

All my trials failed.
In the MSDN I found the following article:

Article ID: Q101742
Creation Date: 21-JUL-1993
Revision Date: 21-JUN-1995

The information in this article applies to:

- Microsoft Visual Basic for Windows, version 3.0

[...]
The standard file extension used by dBASE for tables is .DBF. In Visual
Basic version 3.0 using the dBASE installable ISAMs, you can open a
table by specifying the file name without this extension because the
dBASE installable ISAM assumes the extension to be .DBF by default. If
you specify the extension <filename>.<extension>, the dBASE installable
ISAM will not recognize it and will give you the following error
message:

   <filename>.<extension> isn't a valid name.

To open a dBASE table file that has a non-standard file extension,
specify the table name as <filename>#<extension>. The dBASE installable
ISAM interprets the pound sign (#) in the table name as a period and
opens the dBASE table.
[...]

But this does not work with VB5!
It only works when I rename the file to .DBF - but I can't change the
filename...

Here some details of my SourceCode:
    Dim MF As Database
    Dim RS As Recordset
    Dim sDB As String    
    Dim sName As String

    sDB = "c:\Folder\Dbase\"
    sName = "Something.mdb"
    Set MF = OpenDatabase(sDB, 0, 0, "Dbase III;")

    ' Here it seems to be ok.
    ' But if I watch the MF-Object then there are no items in
    ' the tableDefs. tableDefs.count is 0.

    Set RS = MF.OpenRecordset(sName, dbOpenTable)

    ' And this returns nothing!!!
    ' it doesn't matter if I try 'Something.mdb',
    ' 'Something#mdb' or just 'Something'

    ' What is wrong?

Thanks in advance...
Michael

--
Remember, even if you win the rat race, you're still a rat...



Mon, 07 Jan 2002 03:00:00 GMT  
 Open dBASE III-DB with non-standard file extension in VB5
Hi,
here is the solution:
There is a problem with the long filenames. Use of a short filename will
work. (e.g., c:\Folder\Dbase\Someth~1.mdb)
Michael

--
Remember, even if you win the rat race, you're still a rat...



Mon, 07 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. open dbase type dbase III

2. VB6 code for opening dBASE III files

3. Opening and adding to DBase III file

4. Connecting to Clipper DB with non-standard file extn

5. Error 3170 while opening a DBASE IV file with VB3.0 Standard

6. Error 3170 while opening a DBASE IV file with VB3.0 Standard

7. Open DBASE III DATABAE PLEASE HELP!

8. need example opening DBASE III ->combobox

9. Linking a dBase III table to an Access 2000 database - won't open

10. VB5 + DBase III Question

11. Using DBase III index in VB5

12. creating dbase III tables in vb5.0

 

 
Powered by phpBB® Forum Software