Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Posts
    1

    Unanswered: Can't Read From Visual Basic.

    I'm getting an error that says type mismatch. Does anyone
    see an error in my code, or know a reason why this does not
    work?
    _____________________________________________
    Dim db As Database
    Dim rs As Recordset

    Set db = OpenDatabase("<correct path>")
    Set rs = db.OpenRecordset("SELECT * FROM tblTeachers;")

    Do Until rs.EOF
    lstAll.AddItem rs.Fields("Last Name") & ", " & _
    rs.Fields("First Initial")
    ----------------------------------------------------------

  2. #2
    Join Date
    Jan 2003
    Location
    Rockville, MD
    Posts
    179
    Are there any data in tblTeachers with null values for "Last Name" or "First Initial"?

    If so, try
    Code:
    lstAll.AddItem nz(rs.Fields("Last Name"),"") & ", " & _
    nz(rs.Fields("First Initial"),"")

Posting Permissions

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