Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY? Two Db's in same directory with same Table yet, one wont open

Status
Not open for further replies.

ranshe

Programmer
Oct 5, 2004
27
0
0
US

This is the code that causes my problem:

Code:
Public db As Database
Public recset As Recordset

Private Sub Form_Load()
Set db = OpenDatabase("C:\Documents and Settings\res982\My Documents\Nwind.mdb")
Set recset = db.OpenRecordset("Customers", dbOpenTable)
If recset.EOF = False Then
    Label1.Caption = recset.Fields(0) & "  # of Records: " & recset.RecordCount
Else
    Label1.Caption = "No Records if TxtTable1" & "# of Records: " & recset.RecordCount
End If
Close All
End Sub

When I use the code that is for the open db with the Nwind.mdb (This is a copy of the Microsoft Nwind.mdb that comes with VB for testing) the code works fine (as above).
When I change the Nwind.mdb name in the code with my own mdb called Txtdb.mdb, I get the following error message:
Run-time error '3343':

Unrecognized database format 'C:\Documents and settings\res982\My Documents\Txtdb.mdb'.

My own Txtdb.mdb is in the same directory as the Nwind.mdb. Txtdb.mdb is an mdb with only one Table in it and nothing else. The table was imported from the Nwind.mdb and has the same name as in Nwind.mdb: Customers.

What would be causing this error?
 
it is possible that your database is corrupted. Have you tried just creating another generic database with some fake data just to see if it will open? That error usually means that it can't understand the structure of the file that you are trying to open. I would just open access and try to create a new table, just to test.

Good luck,
Kevin

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
Check the versions of the access databases. Yours might be newer.

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
The versions were incompatible. Apparently I have an early version for VB that only sees Access97 and I have Access2000.
Thanks!
 
You should be running SP6, downloadable from MS

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top