Question

  Asked: Jun 28 2008   5:53 PM GMT
  Asked by: Ttstudio


Add module to remote access database


Access, VBA, MDB, Access 2000

I have 100+ access 2000 .mdb's that I need to add a specific module to. What I want to do is loop through all mdb files in a specific directory and add a standard module to each one. Any ideas as to how to accomplish this from within access vba would be appreciated. I intend to do this from within a separate access mdb

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



I know this is late, but hopefully this will help someone.

Here is some code that will get you started.

If you want to iterate through a folder, working on each MDB file (or any file for that matter), here's some sample code using Scripting Runtime library. I'm assuming that the folder contains a mix of mdb and other files.

(make sure to set a reference to Microsoft Scripting Runtime)

Sub LoopThroughFiles()

Dim strFiletype As String
Dim strMyFilename As String
Dim fso As Scripting.FileSystemObject
Dim objFile As Object

Const strFolder As String = "C:\" ' replace this with the path to the folder

Set fso = New Scripting.FileSystemObject

For Each objFile In fso.GetFolder(strFolder).Files
strMyFilename = objFile.Name
strFiletype = Right$(strMyFilename, 3)

If UCase$(strFiletype) = "MDB" Then
' your code to add a module here
End If

Next objFile

End Sub
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Database.

Looking for relevant Development Whitepapers? Visit the SearchWinDevelopment.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register