Yussi Ariefiyono
Archive for April, 2010
Access link table from different database with vba
Apr 8th
Problem:
you have lots of database with link table in it, and in one time some of path are changed.. rather than change them manually, i create function that can do that for me
Solution:
In this function you can specify the link you want to find and replace it with your new link. it save me lots of time..
Function RelinkTable(setDB As String, FINDtext As String, REPLACEtext As String)Dim dbs As DatabaseDim Tdf As TableDefDim Tdfs As TableDefsSet dbs = OpenDatabase(setDB)Set Tdfs = dbs.TableDefs‘Loop through the tables collectionFor Each Tdf In TdfsIf Tdf.SourceTableName <> “” And Tdf.Connect = “;DATABASE=” & FINDtext Then ‘if its the linktableTdf.Connect = “;DATABASE=” & REPLACEtext ‘Set the new sourceTdf.RefreshLink ‘Refresh the linkEnd IfNext ‘Goto next tableSet dbs = NothingSet Tdfs = NothingEnd Function
get the latest file with batch command
Apr 8th
Problem:
get the latest file in the folder with batch command, in my case after getting the latest file. i will move it to other directory
Solution:
copy and paste this code, change it according to your need
@echo offsetlocal:source directoryset srcDir= your source directory:destination directoryset destdir=your destination directoryset lastmod=pushd “%srcDir%”for /f “tokens=*” %%a in (‘dir /b /od 2^>NUL’) do set lastmod=%%aif “%lastmod%”==”" echo Could not locate files.&goto :eof:copycopy “%lastmod%” “%destdir%”:deletedel “%lastmod%”
enjoy