|
-
Feb 11th, 2000, 09:44 AM
#1
Thread Starter
Hyperactive Member
I have installed ms office 2000 lately ....
i wish i didnt it so messy .... now i cant open anymore dbs with vb6 , it seems it doesnt recognise the db "format" ....
ANything i can do to fix this other than UNINSTALL MSOFFICE 2000 ???
------------------
- regards -
- razzaj -
-
Feb 11th, 2000, 10:06 AM
#2
Hyperactive Member
I had a similar problem recently and it drove me nuts trying to figure out what the hell was going on. It turned out that I did not have all of the necessary references added to the project. Be sure that you have a reference added for Microsoft Access 9.0 library and for DAO 3.6 (or ActiveX Data Object 2.1 if that is what you are using).
-
Feb 11th, 2000, 08:54 PM
#3
Hyperactive Member
What are you doing to try to open the db? (ie code etc)
This works for me...
Code:
cnn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<path to the db>;"
rst.open "SELECT * FROM <a table>", cnn, adopenkeyset, adlockoptomistic
Let me know more details.
------------------
Matt G
Either [email protected]] or [email protected]
-
Feb 11th, 2000, 10:05 PM
#4
Thread Starter
Hyperactive Member
i inserted all of the references and still had a problem , so i inserted other references :
MS data formating object lib.
MS Access 9.0 object library
MS ActiveX data object lib 2.1
MS ActiveX data object Recordset lib. 2.1
MS DAO 3.6 object lib.
so the unsrecognised error disapeared but now i have another one : "Type mismatch"
so i thought maybe there is an error in the code so there i am pasting the code , hoping that anyone can help :
Dim oDB As Database
Dim oRs As Recordset
Dim addline As ListItem
'Open your Database
Set oDB = Workspaces(0).OpenDatabase(App.Path & "\file.mdb")
'Select the Records You Want in the Listbox, In This Example, the LastName of all Employees
Set oRs = oDB.OpenRecordset("Select membername FROM Memberlist", dbOpenForwardOnly)
While Not oRs.EOF
'Step through the Recordset adding the "LastName" Field of Each Record to the Listbox
Set addline = ListView1.ListItems.Add(, , oRs("membername"))
addline.SubItems(1) = oRs("memberlastname")
oRs.MoveNext
Wend
------------------
- regards -
- razzaj -
-
Feb 11th, 2000, 10:30 PM
#5
Thread Starter
Hyperactive Member
Gravyboy ,
i tried ur way but it didnt work , i made some changes and still nothing , vb pointed out ".open" as unrecognised member function , something like that ...
more help ???
i really need this now .
------------------
- regards -
- razzaj -
-
Feb 11th, 2000, 11:17 PM
#6
Hyperactive Member
As far as the references are concerned, you are not using ActiveX so the references to ActiveX probably are not necessary.
Originally posted by razzaj:
so the unsrecognised error disapeared but now i have another one : "Type mismatch"
so i thought maybe there is an error in the code so there i am pasting the code , hoping that anyone can help :
Dim oDB As Database
Dim oRs As Recordset
Dim addline As ListItem
'Open your Database
Set oDB = Workspaces(0).OpenDatabase(App.Path & "\file.mdb")
'Select the Records You Want in the Listbox, In This Example, the LastName of all Employees
Set oRs = oDB.OpenRecordset("Select membername FROM Memberlist", dbOpenForwardOnly)
While Not oRs.EOF
'Step through the Recordset adding the "LastName" Field of Each Record to the Listbox
Set addline = ListView1.ListItems.Add(, , oRs("membername"))
addline.SubItems(1) = oRs("memberlastname")
oRs.MoveNext
Wend
One error that I see in your code is that you never move to the first record of oRs. You should have the above code enclosed in this IF statement:
If oRs.BOF = False and oRs.EOF = False then
oRs.MoveFirst
Insert your WHILE LOOP here
End if
As far as the Type Mismatch error, I have not used the ListView and can't offer much other help. With other controls though, type mismatch errors occur when you try to pass incompatible data types, e.g. a text value to a numeric field. Double check all of the properties of your listview and database.
Chao and feel free to email me if you need any more help!
Andrew
------------------
Andrew Nerney
[Hapless Programmer]
[email protected]
[This message has been edited by DrewDog_21 (edited 02-12-2000).]
-
Feb 12th, 2000, 12:06 PM
#7
Guru
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
|