Results 1 to 15 of 15
  1. #1
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17

    trying to read datain excel from an access database

    ive never really worked with access but what I am trying to do is have a macro that looks in the access file and the table is called "updates" and within that table I want it to look in the column called "station" and in the column called "date" and the column called "updates" to see if there is a match within a row.




    so in my excel file range A2 has the station number so when the macro runs it looks at the value of cell A2 in the excel file and then trys to see if there is a match in the access file with todays date from "date" column and and the word UPDATED from the "update" column are in the same row together..

    I know this probably sounds confusing... any questions just ask...

    the excel path = C:\Users\user\Desktop\updates.xlsm
    access path = C:\Users\user\Desktop\access updates.accdb

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Attach the excel file as a table.
    build a query that joins the [date] to get your results.

  3. #3
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    I was trying to use a macro because I have about 60 of these excel files so it would be easier to copy the macro in each file thnaak you

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    do you need code to scan the folder for all xl files and load them via macro?

  5. #5
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    no the code will be a macro in each excel workbook and when run it will open the access database to the table called updates and if the value of cell A2 in the excel file which would be in the "stations" column and todays date from "date" column and the word UPDATED from the "update" column are in the same row together.. if they are in the same row it will exit sub and if there isn't a match then a msgbox will appear that says "needs to be updated"

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Why would you open 60 workbooks and run 60 macros,
    when you can open access and run 1 macro that will process 60 workbooks?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Excel can pull data from Access by either linking or in VBA (Excel macro) connect to Access and query table/query object. Example:

    Public Sub GetData()
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source='path to database\databasename.accdb'"
    rs.Open "SELECT * FROM table/query WHERE some criteria here;", cn, adOpenStatic, adLockReadOnly
    End Sub

    Why is Excel involved at all?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    excel is where all the associates keep track of their work station data and then it is transferred to access when it is updated so we can better look at the data... I know it probably sounds confusing im sorry

  9. #9
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    60 workbooks for 60 station each station has their own

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    These users are all on the same network? Why not build multi-user database for direct input?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    I would like to do that but I cannot make that call... they have years worth of work in the coding of the excel files VBA so they will only let me do it this way.. I know it seems "dumb" to do it the way that im trying to do it but that's all they will let me

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    And what does that coding do?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    a ton of different things from verifying things through calling up a lookup table and updating statuses into access keeping track of schedules...

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    All of which can be done in Access. Maybe if you build it they will come?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    justlearning123 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    17
    That's a good thought.. I will try but like I said im not very familiar with MS access

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

Similar Threads

  1. Replies: 2
    Last Post: 05-24-2015, 02:22 PM
  2. Access database becomes read only after linking to excel?
    By krossi in forum Import/Export Data
    Replies: 3
    Last Post: 05-22-2014, 04:38 PM
  3. Export Access data to Excel as Read-only
    By rmmhie in forum Import/Export Data
    Replies: 1
    Last Post: 10-26-2013, 07:44 AM
  4. Replies: 3
    Last Post: 05-23-2012, 03:05 AM
  5. Read only Access Database
    By Rameez in forum Access
    Replies: 7
    Last Post: 06-23-2009, 12:30 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