Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 14th, 2005, 02:55 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Storing a file patch from a common dialog box

Hello,

I am really lost, I am trying to think of a way I can make a user click a button and then basically a folder will open up and the user can select any file. When they select the file the path of that file will be saved in a textbox. Any ideas. Thanks

Martin

Reply With Quote
  #2 (permalink)  
Old March 15th, 2005, 09:38 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Hi,

   I needed to do this very same thing. The way I did it was to start by capturing the file names on a particular path, then loading those to a temporary table, then opening a continuous form, and having a button next to each file name for them to select the value and push it to the table or text box.

   Here is how I started:

On the form, I put a button to list files, and then used this code on the button's On Click event:

'=====
Private Sub Command0_Click()

    Dim filesys As Variant
    Dim demofolder As Variant
    Dim fil As Variant
    Dim filecoll As Variant
    Dim filist As Variant
    Dim rs As Recordset
    Dim db As Database
    Dim stFirstName As String
    Dim stLastName As String
    Dim stName As String
    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim stSSN As String

    Set db = CurrentDb()
    Set rs = db.OpenRecordset("tblLocalFile", dbOpenDynaset)

    Set filesys = CreateObject("Scripting.FileSystemObject")

    Set demofolder = filesys.GetFolder("I:\EnvHealth\ACCESS\Data\Scanne dDocuments")

    Set filecoll = demofolder.Files

    For Each fil In filecoll
            rs.AddNew
            rs!LocalFile = fil.Name
            rs.Update
    Next

    stDocName = "frmLocalFileList"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
'=====

   The form frmLocalFileList was a continuous form based on the table tblLocalFile, and next to the text box in the continuous form I put another button. Unfortuantely I never got as far as inserting the data from this field, but another poster may get you that far. I ended up automatically associating files to records using a foreign key table so that more than one file could be associated with the patient, in this case.

   If you are putting these file associations in NEW records (for example in a linked table,) then repost and I will show you that code modified to take the manual selection. Remind me that we will want to add code in that process to dump the contents of the temp table (tblLocalFile) after the update to prevent dupes.

HTH


mmcdonal
Reply With Quote
  #3 (permalink)  
Old March 16th, 2005, 03:58 PM
Authorized User
 
Join Date: Jan 2005
Location: , , .
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks thats a great idea, gonna work on it now

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
coding problem in common dialog box cancertropica Visual Basic 2005 Basics 0 July 30th, 2008 09:38 AM
How to use the flags int common dialog box diegoblin Beginning VB 6 2 November 8th, 2006 03:41 PM
Using common dialog with access azkabancells VB Databases Basics 2 May 14th, 2005 06:01 AM
Instantiating Common Dialog Box Dhodie Pro VB 6 2 July 19th, 2004 04:28 AM
Open File Dialog Box KennethMungwira VB.NET 3 August 3rd, 2003 09:44 PM



All times are GMT -4. The time now is 09:29 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.