Click to See Complete Forum and Search --> : Opening Access 2000 database from VB5/6 (ADO or DAO?)
edmorriss111
Jan 4th, 2000, 08:36 AM
I'm trying to open a Microsoft Access 2000 database through VB5 and keep getting error 3343 - "Unrecognized Database Format".
Do I use DAO references or ADO references?
Does anyone have some examples that actually work? I'm using a windows 98 platform. If anyone can answer my question and maybe add a little extra I would appreciate it.
Thanks.
------------------
ed
Clunietp
Jan 4th, 2000, 01:00 PM
http://support.microsoft.com/support/kb/articles/q238/4/01.asp?LNG=ENG&SA=ALLKB
edmorriss111
Jan 5th, 2000, 05:19 AM
Thanks Clunietp for the info.
What I also forgot to mention was that I was using the DBGrid control in VB5 made by APEX Software. I called them about it today and they informed me that they assisted in that versions development(version 5.00.3714) and now have nothing else to do with Microsoft. Therefore, that version is not compatible with newer versions of their software.
I'll try VB6 and see what happens.
Thanks again.
------------------
ed
FirstKnight
Jan 5th, 2000, 03:41 PM
Ed,
I use VB6 and I have a similar problem with Access 2000 dbases. It would seem that ADO doesnt recognize the new db format. I know because I tried to create a dbase form using the wizard. The only way I could get around this was to create a data environment and then go and create al my text boxes manually, setting the datasource property to the data environment. If you don't know what a data environment is I suggest you read through your manuals or help files. I havent tried this with datagrids yet but I'm sure it works the same.
If anyone knows a easier way please let me know, coz it is quite a tedious tast to create all the text boxes on a form manually.
------------------
Clunietp
Jan 6th, 2000, 12:19 AM
FirstKnight:
If you are using ADO, you need to set your provider to Microsoft.Jet.OLEDB.4.0 to connect to Access 2000 databases. I don't use the Data Env so I don't know where to set this property in there...
If you are using DAO, then follow the procedure in the link I posted above.
Tom
edmorriss111
Jan 6th, 2000, 01:31 AM
Hey everybody!
I finally figured out the DBGrid problem I was having!
I created a simple Acc. 2000 database and dropped a "DBGrid" and a "Data" object onto a form. Normally you set the "DatabaseName" and "RecordSource" properties to the appropriate database and table, but don't do this with Access 2000!
Instead, just set the "DataSource" property for the "DBGrid" to the "Data" object, and the rest is accomplished through code like this:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Private Sub Form_Load()
Set db = DAO.Workspaces(0).OpenDatabase("c:\scottsdb\scott.mdb")
Set rs = db.OpenRecordset("table1")
Set Data1.Recordset = rs
''Ignore this:
'DBGrid1.DataSource = Data1
End Sub
Weird but works!
Thanks for your help though. Much apprecitated!
------------------
ed
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.