Add module to remote access database

45 pts.
Tags:
Access
Access 2000
MDB
VBA
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
ASKED: June 28, 2008  5:53 PM
UPDATED: August 30, 2008  2:04 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following