Howdy, Stranger!

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

Categories

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

  • blaydeblayde Member Posts: 37

    : 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
  • Shawn CarterShawn Carter Member Posts: 0

    | http://forcoder.org | free video tutorials and ebooks about || Ruby Go Java C++ Objective-C Perl Swift C# MATLAB PHP Delphi Python PL/SQL R Visual Basic JavaScript Visual Basic .NET C Scratch Assembly LabVIEW Hack ABAP Kotlin FoxPro Lisp Crystal Scala Dart Rust D Bash Ada Awk VBScript Transact-SQL COBOL Scheme Prolog Alice Logo Erlang ML SAS Lua Fortran F# Julia Clojure Apex ||

Sign In or Register to comment.