Compiler not recognizing DAO object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmadbaseet
    New Member
    • Aug 2007
    • 15

    #1

    Compiler not recognizing DAO object

    Hello every one. I am new to MS Access. I am using data SQL command SELECT to fetch some data from Access tables. I want to use DAO.Recordset object to get the data, but somehow my compiler is not recognizing the DAO object. I am using Access 2003. Can somebody help me. I cannot declare Dim rs As DAO. Thanks in advance
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Is the Microsoft DAO 3.6 Object Library set in references?
    (Tools - References)
    Then
    Dim db As DAO.Database
    Dim rs As DAO.Recordset

    Linq ;0)>

    Comment

    • ahmadbaseet
      New Member
      • Aug 2007
      • 15

      #3
      Hello, Can u please tell me how to set it?.Actually Whan I write Dim rs As, and then press space, the list comes in which all the classes are their, for example, String etc. But DAO is not their. I saw on my friends computer. it was their in Access 2003. As said I am new to Access. Thanks. Plz explain it if u can.. Very thanks in advance

      Comment

      • ahmadbaseet
        New Member
        • Aug 2007
        • 15

        #4
        Actually I am doing something like that

        Dim rst as DAO.recordset

        set rst = currentdb.openr ecordset("SELEC T Atty_TK,Client, Matter,Descript ion FROM qry_LastJob")

        if not rst.bof and not rst.eof then

        Me.cmbo_atty = rst("Atty_TK")
        Me.cmbo_Client = rst("Client")
        Me.cmbo_matter = rst("Matter")
        Me.Description = rst("Descriptio n")
        end if

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          To set the reference go into the VBA code editor from Design View for any form, then goto Tools - References and scroll wayyyyyyyyyy down until you get to Microsoft DAO 3.6 Object Library. Check it and click on OK and you should be set!

          Linq ;0)>

          Comment

          • ahmadbaseet
            New Member
            • Aug 2007
            • 15

            #6
            Ahhh.. ok.....Very very thanks.... Sorry about my English..

            Comment

            • ahmadbaseet
              New Member
              • Aug 2007
              • 15

              #7
              One more problem, I have two table which are connected thru one to many relationship. I am entering data in the main table with sql command. But getting Error Kay voilation error. I set one field as a primary key. Why am I getting KEY VOILATION error. Thanx

              Comment

              Working...