UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> SelectDB    
CODE

' SelectDB
' http://www.utteraccess.com/wiki/index.php/FunctionNameHere
' Code courtesy of UtterAccess Wiki
' Licensed under Creative Commons License
' http://creativecommons.org/licenses/by-sa/3.0/
'
' You are free to use this code in any application,
' provided this notice is left unchanged.
'
' rev  date                          brief descripton
' 1.0  2012-05-30                Prompts the user to select the database to transfer Queries to

Public Function SelectDB() As String
On Error GoTo errHandler
Dim dlgopen As FileDialog, strLocation As String
Set dlgopen = Application.FileDialog(msoFileDialogFilePicker)
strLocation = "No DB Selected"
   With dlgopen
       .Title = "Select DB to Transfer Queries to"
       .filters.Add "Microsoft Access 2003 Database", "*.mdb"
       .filters.Add "Microsoft Access 2007 - 2010 Database", "*.accdb"
       .FilterIndex = 2
       If .Show = -1 Then
               strLocation = dlgopen.SelectedItems(1)
       End If
       SelectDB = strLocation
   End With
ExitHere:
  Set dlgopen = Nothing
  Exit Function
errHandler:
  With Err
     MsgBox "Error " & .Number & vbCrLf & .Description, vbOKOnly Or vbCritical
  End With
  Resume ExitHere
End Function

Creative Commons License
SelectDB by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 2,314 times.  This page was last modified 14:59, 30 May 2013 by dspadic.   Disclaimers