Results 1 to 7 of 7

Thread: Problem opening Access 2000 With VB 6 ....

  1. #1

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    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 -

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Post

    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).

  3. #3
    Hyperactive Member gravyboy's Avatar
    Join Date
    Jan 2000
    Location
    Where I was before . . . if you don't know then you're new!
    Posts
    334

    Post

    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]

  4. #4

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    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 -

  5. #5

    Thread Starter
    Hyperactive Member razzaj's Avatar
    Join Date
    Oct 1999
    Location
    jounieh
    Posts
    261

    Post

    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 -

  6. #6
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Post

    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).]

  7. #7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width