Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: object not set error

    I'm new to access
    I keep getting a object variable not set for the following query:

    Private Sub lstDRIVER_Click()
    Dim sDriver As String
    Dim query As String
    Dim queryset As Recordset
    Dim currentdb As Database

    sDriver = Me.lstDRIVER

    query = "Select team from teams where '"
    query = query + sDriver
    query = query + "' In(driver1,driver2);"

    Set queryset = currentdb.OpenRecordset(query, dbOpenDynaset)
    txtTeam = queryset!team

    any suggestions would be greatly appreciated

  2. #2
    Join Date
    Feb 2003
    Auckland, NZ
    change the following declaration

    Dim currentdb As Database

    to something like

    Dim Db as Database

    CurrentDb is a reserved word in Access

    before setting the recordset you have to set the database


    Set Db = CurrentDb
    JJ Kennedy
    Double J IT Solutions

    VB 6, VB.NET, ASP.NET, MS SQL Server, MySQL, MS Access

Posting Permissions

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