|
-
Sep 17th, 2000, 11:43 AM
#1
Thread Starter
Lively Member
I was creating a db program that use an MS Access database to hold the actual information. I started with MS Office 97pro & VB5, and everything was working fine. I picked up Office 2000 and installed it, and when I went to open the databse, it asked me if I wanted to upgrade it, I said sure, figuring it can't hurt (silly me). Now VB won't read the database, it keeps giving the error messege "Unrecognized database format". I thought that upgrading to VB6.0pro would fix it, but as I have done that already, and it still won't read the database. Any ideas on how to get VB to read Access 2000 databases? Thanx.
Thanx.
Rick Goodrow
-
Sep 17th, 2000, 11:45 AM
#2
Monday Morning Lunatic
If you're using DAO, make sure that you have version 3.6 selected (check under Project->References).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 17th, 2000, 01:01 PM
#3
Thread Starter
Lively Member
I tried that. I found "Microsoft DAO 3.6 Object Library" and checked it. VB required me to uncheck "Microsoft DAO 3.51 Object Library" but whenever I try to run it. I still get the same message. Any other ideas?
-
Sep 17th, 2000, 03:10 PM
#4
Monday Morning Lunatic
What code are you using to open the DB?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 17th, 2000, 03:35 PM
#5
Thread Starter
Lively Member
I'm not specifically using an open command. I just put a database object into the form, and linked it to the file. The first command I use with it is
'datinv.recordset.movelast'
to populate it.
Also, wnen I try to add a new database object and set the databasename to a Access 2000 database, I get the same error message, and can't even select a recordset.
-
Sep 17th, 2000, 03:38 PM
#6
Monday Morning Lunatic
That's your problem. Make sure you have the latest version of the DataControl. Although, it's a lot better to use code to open the DB.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 17th, 2000, 04:41 PM
#7
Fanatic Member
Code is Key. Then the DAO 6.0 Library works, if you want code reply. I will give you some DAO Code to open the DB
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Sep 18th, 2000, 09:37 AM
#8
Thread Starter
Lively Member
If somebody can give me code for it, that'd be great, but I've never used code to open a database before, so I'll be new at it.
Also, the other problem is that when I place a data control on the form, then try to adjust the "DatabaseName" property to the Access 2000 file, I get the same error message, and it doesn't work. Could this be a problem with not having the latest Data Control?
P.S. This may be pushing it, but could somebody also provide a link to the latest Data Control please? (Haven't been on in awhile)
-
Sep 18th, 2000, 03:52 PM
#9
Fanatic Member
Sure, add the reference to the DAO 3.60, then:
Code:
Dim myDB As Database
Dim myRS As Recordset
Dim Records As Integer
Dim MyText() As String
Dim i as Integer
Set myDB = DBEngine.Workspaces(0).OpenDatebase("c:\My DB.mdb")
Set myRS = myDB.OpenRecordset("MyRS")
'put code here, i.e.
myRS.MoveLast
Records = myRS.RecordCount
ReDim MyText(Records)
myRS.MoveFirst
'to retrive data:
i = 1
Do Until myRS.EOF
i = i + 1
MyText(i).Text = myRS!Field
MyRS.MoveNext
Loop
myRS.Close
myDB.Close
Set myRS = Nothing
Set myDB = Nothing
Note: This is not tested, but it should work!!!
[Edited by gwdash on 09-18-2000 at 05:02 PM]
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Sep 18th, 2000, 04:00 PM
#10
Thread Starter
Lively Member
-
Sep 18th, 2000, 04:02 PM
#11
Fanatic Member
Oops, i edited something, you must close it all.
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Sep 18th, 2000, 04:11 PM
#12
Thread Starter
Lively Member
but you don't have to close it until the end, right?
-
Sep 18th, 2000, 10:04 PM
#13
Thread Starter
Lively Member
Okay, I morphed that code into my program, and it uses the Access 2000 databases correctly now.
Except that another problem popped up. All of my .findfirst commands now say "operation is not supported for this type of object."
Now the question is how do I replace those commands with working commands that accomplish the same thing.
-
Sep 19th, 2000, 12:58 PM
#14
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 20th, 2000, 09:45 AM
#15
Thread Starter
Lively Member
.movefirst works, but the .findfirst doesn't work, which is what I use to search for records.
-
Sep 20th, 2000, 12:49 PM
#16
Monday Morning Lunatic
To find records, use:
Code:
Set rst = DB.OpenRecordset("SELECT * FROM TheTable WHERE TheField=5")
rather than opening the table and using .FindFirst.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 20th, 2000, 04:47 PM
#17
Thread Starter
Lively Member
so if I have
BobDB as a database variable
CustomerRS as a recordset variable
and lets say I wanted to find "John" under the [First Name] field in the CustomerRS recordset.
What would the syntax be?
-
Sep 21st, 2000, 10:46 AM
#18
Hyperactive Member
Sorry for the intrusion, I am trying to learn how to use databases with VB
and want to be alerted to the update to this thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|