[AccessD] Retrieve path to a file - Common Dialog Control

A.D.Tejpal ad_tp at hotmail.com
Tue Apr 29 07:18:05 CDT 2003


Joe,    

    In Access 2002, you can also try FileDialog Object. The code given below will display a dialog box for File Selection. Based upon user's choice, the variable TargetFile will give Full Path of Selected File.

Dim fdg as Object, TargetFile As String

Set fdg = Application.FileDialog(3)
' Arguments -   1(FileOpen), 2(FileSaveAs), 3(FilePicker), 4(FolderPicker)

With fdg
    .Title = Space(71) & "Select  Source  File"
    .AllowMultiSelect = False    ' (Or True as Reqd)
    If .Show <> 0 Then
        TargetFile = Trim(fdg.selecteditems(1))
    End If       ' Show
End With     ' fdg

' Note - If MultiSelect is set True, use For/Each Loop to cycle through fdg.Selecteditems

Regards,
A.D.Tejpal
----------------------------
  ----- Original Message ----- 
  From: Brett Barabash 
  To: 'accessd at databaseadvisors.com' 
  Sent: Tuesday, April 29, 2003 01:28
  Subject: RE: [AccessD] Retrieve path to a file - Common Dialog Control


  Trust me, you're better off using the API calls.  The common dialog OCX is
  just a wrapper for the DLL that is called by the API.  Even though they are
  "supposed" to be binary compatible, newer versions of IE caused my projects
  to break.

  Avoid distributing OCXes wherever possible.  Otherwise, be prepared to walk
  a user through manually RegSvr'ing a control that didn't properly register.


  -----Original Message-----
  From: Joe Rojas [mailto:JRojas at tnco-inc.com]
  Sent: Monday, April 28, 2003 1:07 PM
  To: 'accessd at databaseadvisors.com'
  Subject: RE: [AccessD] Retrieve path to a file - Common Dialog Control


  NP Nacy.

  I stumbled across the MS Common Dialog control and I will end up using it
  instead of APIs. Unless of course someone has a good reason why I shouldn't.
  :)

  Thanks,

  Joe Rojas

  -----Original Message-----
  From: Nancy Lytle [mailto:nancy.lytle at auatac.com]
  Sent: Monday, April 28, 2003 1:55 PM
  To: accessd at databaseadvisors.com
  Subject: RE: [AccessD] Retrieve path to a file

  I wish I could think of the name of it now, but I used to have a nice little
  utility that went into the Send To on the right click menu.  If you went to
  a file in Windows Explorer you could right click on it > Send To>clipboard
  and the full file path including the file name were saved to the clipboard.
  Wish I could find it for you:(

  Nancy

  -----Original Message-----
  From: accessd-bounces at databaseadvisors.com
  [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Joe Rojas
  Sent: Monday, April 28, 2003 1:47 PM
  To: 'accessd at databaseadvisors.com'
  Subject: [AccessD] Retrieve path to a file


  Hello All,

  How does anyone have any code examples that results in a dialog box opening
  and allows that user to navigate to a specified file and return the path to
  the file?
  I am pretty sure that it is possible to use windows API calls for something
  like this, but I am not very knowledgeable about using API calls.

  Thanks!

  Joe Rojas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030429/01c7769d/attachment-0001.html>


More information about the AccessD mailing list