opening a file?

hello, i am relativly new to VB and my problem is that i am trying to open an ms access97 file through the module in my VB project. My code is:

Public db As Database
Public rs As Recordset
Public loginid As String

Public Sub main()

Dim filename As String

Set db = OpenDatabase("a:users.mdb")
Set rs = db.OpenRecordset("id", dbOpenTable)
rs.Index = "id"
Form1.Show

End Sub

I don't see a problem with this bit but why does it give the error "type mismatch" on the line "Set rs = db.OpenRecordset("id", dbOpenTable)" line? Anysuggestions can be very helpful to me thank you

Comments


  • : Set db = OpenDatabase("a:users.mdb")
    : Set rs = db.OpenRecordset("id", dbOpenTable)
    : rs.Index = "id"
    : Form1.Show

    : I don't see a problem with this bit but why does it give the error "type mismatch" on the line "Set rs = db.OpenRecordset("id", dbOpenTable)" line? Anysuggestions can be very helpful to me thank you

    "id" has to be a table name. it looks to me like it may be the name of a column/field within a table instead.

    ie

    database : users.mdb

    table : employees

    columns ( in table 'employees' ) : id, name and surname
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion