Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub Form_Load()
'declare database, recordset, table name and SQL variables
Dim dbs As Database, rst As Recordset, strSQL As String, strTblName As String
Dim I 'general count variable for loop below
Set dbs = CurrentDb
strTblName = "tblDatabaseListing"
'Delete the old table, if it exits
On Error Resume Next
dbs.TableDefs.Delete strTblName
'Generate an empty Database name table in calling database
strSQL = "CREATE TABLE " & strTblName & "(DbName TEXT (40));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
'Now we need to fill the table - first, create a reference to the table
Set rst = dbs.OpenRecordset(strTblName)
With Application.FileSearch
.NewSearch
.LookIn = "L:\"
.FileType = msoFileTypeDatabases
If .Execute > 0 Then
For I = 1 To .FoundFiles.count
rst.AddNew
rst!DbName = .FoundFiles(I)
rst.Update
Next I
Else
MsgBox "No database files found", vbInformation, "No Database Files Located"
Exit Sub
End If
End With
lstDatabases.RowSourceType = "Table/Query"
lstDatabases.RowSource = strTblName
rst.Close
dbs.Close
End Sub
Private Sub lstDatabases_DblClick(Cancel As Integer)
Dim strDbName
Dim appAccess As Access.Application
strDbName = lstDatabases.Column(0)
Set appAccess = CreateObject("Access.Application.8")
appAccess.OpenCurrentDatabase strDbName
appAccess.Visible = True
End Sub