Updating data with an ODBC link to ACCESS

G

Guest

Does anyone know the best approach for this?

I have (roughly) 200 EXCEL files that have VLOOKUPs to 5 additional
spreadsheets which have ODBC links to various rate tables in an ACCESS
database. Here's the scenario:

Part 1.

In ACCESS, I have a various Rate Tables where I maintain and update
corresponding rates for various programs. As these rates are changed in
ACCESS, the corresponding EXCEL spreadsheets (having an ODBC link) need to
be opened and the updates allowed to process.

Part 2.

The EXCEL spreadsheets are used by a myriad of users to provide updates -- I
don't want a user to inadvertantly click on "Allow Updates" on the ODBC
linked data (especially if we're in the middle of modifying the Rates in the
ACCESS database).

Currently, the decision has been to protect the 200 EXCEL spreadsheets, and
on the EDIT Links, the Item Update is set to "Automatic". From what I can
tell, under the current setup, I would need a script (Macro, VBA, or Batch
File) that would pass the password for each protected spreadsheet, so that
the Automatice Update of the Linked data could execute.

What is the BEST way to handle this scenario? Here are some thoughts I had:

1. Would Information Rights Management (IRM) be an option? (assuming that
we could unprotect the spreadsheet and assign unique permissions for users)
2. Is there a Macro/VBS/ or Batch File scenario which could allow me to
automatically UNPROTECT the spreadsheet, Open it, Allow the Update to take
place, then close the spreadsheet?

NOTE. I relatively NEW to creating Batch Files, and what I have currently
have won't get me past the password issue, nor close the individual EXCEL
files after they're updated:


I'm drawing straws on which approach to take on this -- any help would be
greatly appreciated -- thanks in advance!
 
G

Guest

I'm almost there ...

Does anyone see anything that I may be missing? Here's the MOST important
thing I need this code to do (assuming there are no further modifications
needed) ...

This code (Macro) needs to perform this same task on approximately 200
different Workbooks (all residing in the same Network Directory), but ONLY
when a Command Button is pressed. I'm assuming that I'll need to create a
Form (in ACCESS perhaps) and call this Macro -- correct? How would I do
this, and how would I get this Macro to perform this Link Update on all 200
or so Workbooks?

Private Sub Workbook_Open()
Dim vLinkSources
Dim iLinkSource As Integer
Dim AnySheet As Worksheet
For Each AnySheet In ActiveWorkbook.Worksheets
ActiveWorkbook.Worksheets(AnySheet.Name).Unprotect
Password:="mypassword"
Next
vLinkSources = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(vLinkSources) Then
For iLinkSource = LBound(vLinkSources) To
UBound(vLinkSources)
ActiveWorkbook.UpdateLink vLinkSources(iLinkSource), xlExcelLinks
Next
End If
For Each AnySheet In ActiveWorkbook.Worksheets
ActiveWorkbook.Worksheets(AnySheet.Name).Protect
Password:="mypassword"
Next
End Sub
==================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top