Access MVP (2010-2015)



Recently, I saw a post regarding moving a Query (SQL) to VBA. I remember I saw something somewhere that automated this task but could not remember where. Well, after a little surfing of my favorite sites I found it… Copy SQL statement from query to VBA by Allen Browne. And, because I couldn’t leave well […]

811 total views, no views today

Check if File is there

If Dir("put full filepath and filename here") = "" Then Msgbox "The file was not created." End If

380 total views, no views today

380 total views, no views today

Check if File exists

Sometimes you need to see if a file is in a directory for one reason or another…

Will delete the file if it exists

If FileExists(C:\Folder\Subfolder\YourDatabaseName.accdb) Then Kill "C:\Folder\Subfolder\YourDatabaseName.accdb" Else Msgbox "Nothing to do!" End if

Will rename the file if it exists

If FileExists("\\YourServerName\Folder\Subfolder\" & Me.cboYear & "-VendorReevaluation.xlsx") = True Then xlWBk.SaveAs "\\YourServerName\Folder\Subfolder\" & […]

1,573 total views, 1 views today

FollowHyperlink to file regardless of File Extension

To open a file regardless of the File Extension you can use…

The below is run from a Command Button on a Form the has a Control listing all the files in said directory.

Windows XP…

Dim strFileName As String strFileName = Dir("C:\Documents and Settings\Regina Whipp\My Documents\YourFolcer\" & Me.FieldOnYourFormThatHasFileName & "*") Application.FollowHyperlink ("C:\Documents and Settings\Regina […]

769 total views, no views today