• Home
  • Blog
  • Resume
  • Contact
  • Projects
  • Gallery
  • Amit’s Resume
  • About Nagpur
KEEP IN TOUCH

Access VBA: Link all Dbase files from a folder

Jul18
2007
Leave a Comment Written by admin

If you would like to link all Dbase files, any linkable file for that matter, in MS Access, use the following code. I read somewhere that refreshing the links is slower than deleting and creating new links.

Sub LinkAllTblsinDir()
Dim sTblNm As String, sPath As String, sFileNm As String
sPath = “C:\DW\”
‘Turn of the Echo to avoid window repaint/refresh
Application.Echo False

sFileNm = Dir(sPath, vbNormal)
Do While sFileNm “”
If Right(sFileNm, 3) = “dbf” Then
sTblNm = Left(sFileNm, Len(sFileNm) – 4) ‘Extract the file name
‘Use the TransferDatabase option to link the tables from the specified directory
‘to your current Access DB
DoCmd.TransferDatabase acLink, “dBase III”, sPath, acTable, sTblNm, sTblNm
End If
sFileNm = Dir
Loop

Application.Echo True
End Sub

Related posts:

  1. Get file names from a directory
  2. Save HTML files from one folder to Excel files in another folder
  3. Importing IE bookmark
  4. XY scatter plot in MS Access
Posted in Access, Useful Procedures - Tagged Access, dbase, VBA
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« Get file names from a directory
» Access VBA: Delete tables from Access database

No Comments Yet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Tags

Access Alt F8 Books boxplot cells charts count cursor dashboard data mining dbase design error excel excel functions export filter flip LaTex MS query Number Err ODBC pipes Press Alt F11 Public Sub python R random numbers Range Cells report scripting software sparklines SQL SQL server stack columns statistics stemming string tag cloud text mining UDF VBA visualization wildcard

Network

View Ashutosh Nandeshwar's profile on LinkedIn

Recent Comments

  • W. McNabb on The search key was not found in any record in Access
  • Manuel on The search key was not found in any record in Access
  • Wendy Naples on The search key was not found in any record in Access
  • larry on Access Export to Excel (2007)
  • Betty Chou on Projects

Related Posts

  1. Get file names from a directory
  2. Save HTML files from one folder to Excel files in another folder
  3. Importing IE bookmark
  4. XY scatter plot in MS Access

EvoLve theme by Blogatize  •  Powered by WordPress nandeshwar.info