Solved

Output Directory and Link in Text Box

Posted on 2011-02-23
7
264 Views
Last Modified: 2012-05-11
Hi Experts,

i have a textbox (text47) and a command button (cmd01) on a form as shown in the screen shot. when i click the browse button it should ask me to select the output folder and the same should appear in the text box.
Image
Thanks,
Rodney.
 
0
Comment
Question by:Saichand
  • 3
  • 3
7 Comments
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 500 total points
ID: 34963630
Here is my standard code for this purpose:
Private Sub cmdDocsPath_Click()
'Created by Helen Feddema 28-Nov-2005
'Modified by Helen Feddema 29-Sep-2008

On Error GoTo ErrorHandler
   
   'Create a FileDialog object as a Folder Picker dialog box.
   Set fd = Application.FileDialog(msoFileDialogFolderPicker)
   Set txt = Me![txtDocsPath]
   
   With fd
      .Title = "Browse for folder where __________"
      .ButtonName = "Select"
      .InitialView = msoFileDialogViewDetails
      '.InitialFileName = strPath
      If .Show = -1 Then
         strPath = CStr(fd.SelectedItems.Item(1))
         txt.Value = strPath
         strPropertyName = "DocumentsPath"
         strPropertyValue = strPath & "\"
         lngDataType = dbText
         Call SetProperty(strPropertyName, lngDataType, _
            strPropertyValue)
      Else
         Debug.Print "User pressed Cancel"
      End If
   End With

On Error Resume Next

   DoCmd.RunCommand acCmdSaveRecord
   
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in " & Me.ActiveControl.Name & " procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 34963639
Note that you need a reference to the Office library to use this code.
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 34963656
The setting of a custom property is optional.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Saichand
ID: 34963795
i am gettting a compile error saying sub or function not defined at
Call SetProperty(strPropertyName, lngDataType, _
            strPropertyValue)
0
 

Author Comment

by:Saichand
ID: 34965646
are these the custom property you were talking about??
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34977739
0
 

Author Comment

by:Saichand
ID: 34989044
helen could you please let me know if setproperty is another sub or function?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now