Results 1 to 5 of 5
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 7 Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    How to execute Line of Code

    Dim AccessDB As DAO.Database

    Everytime I Try to run this line of code it errors on me. Something about unrecognized...or another, I know I should have the exact code, but I don't sorry!!

    Can someone explain to me how exactly to implement this code in your db and have it execute error free?!

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    You have to set a reference to

    Microsoft ActiveX Data Objects 2.8

    By going to the VBA Window, to TOOLS > REFERENCES and finding that in the list of potential references and then checking the box next to it.
    Last edited by boblarson; 06-22-2011 at 05:16 PM. Reason: add info

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 7 Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Would that be the case if I can run a db that has the same command in there error free, but when I copy the same code line for line to update a different db it errors?

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by jo15765 View Post
    Would that be the case if I can run a db that has the same command in there error free, but when I copy the same code line for line to update a different db it errors?
    That reference is a PER DATABASE setting so you would have to set it in the other database for it to work.

  5. #5
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 7 Access 2000
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Wonderful! Thank you so much!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 04-11-2011, 03:58 PM
  2. How to do line by line compare of VB code?
    By Buakaw in forum Access
    Replies: 2
    Last Post: 02-14-2011, 11:46 PM
  3. Replies: 5
    Last Post: 12-06-2010, 10:15 AM
  4. Can't get any of my code to execute!
    By blacksaibot in forum Programming
    Replies: 4
    Last Post: 03-16-2010, 08:08 AM
  5. Anything wrong with this one line of code?
    By alsoto in forum Reports
    Replies: 3
    Last Post: 07-01-2009, 09:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums