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?