+ Reply to Thread
Results 1 to 2 of 2

Excel to Access - code help needed

  1. #1
    Registered User
    Join Date
    01-14-2005
    Posts
    2

    Question Excel to Access - code help needed

    I am trying to use this little bit of code and I am not sure what to do with the first line, it says to edit before use, but what does it need? I have the rest of the code figured out, but need some help with this first step.


    Sub DAOFromExcelToAccess()
    ' exports data from the active worksheet to a table in an Access database
    ' this procedure must be edited before use
    Dim db As Database, rs As Recordset, r As Long
    Set db = OpenDatabase("C:\FolderName\DataBaseName.mdb")
    ' open the database
    Set rs = db.OpenRecordset("TableName", dbOpenTable)
    ' get all records in a table
    ....etc...etc....etc.....

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    you need to add reference to you project.

    After you open Visual basic editor, by going to tools->macro->visual basic editor , double click your module,go to the toolbar of visual basic editor, click tools->references go down and select "Microsoft DAO 3.5.1 Object Library" and click ok

    This should solve your problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1