Solved

Output Directory and Link in Text Box

Posted on 2011-02-23
7
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

739 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