Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Output Directory and Link in Text Box

Posted on 2011-02-23
7
Medium Priority
?
317 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 2000 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

927 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