`

Adding a file/folder browser button to a MS Access form

 
阅读更多

1. Folder

 

    Dim objFD As Object
    Dim strOut As String

    strOut = vbNullString
    'msoFileDialogFolderPicker = 4
    Set objFD = Application.FileDialog(4)
    If objFD.Show = -1 Then
        strOut = objFD.SelectedItems(1)
    End If
    Set objFD = Nothing
    FolderSelection = strOut

    Dim strChoice As String
    strChoice = FolderSelection
    If Len(strChoice) > 0 Then
        Me.Text1 = strChoice
    Else
        ' what should happen if user cancelled selection?
    End If

 

2. File

    Dim objDialog As Object
    
    Set objDialog = Application.FileDialog(3)
    
    With objDialog
        .AllowMultiSelect = False
        .Show
        If .SelectedItems.Count = 0 Then
            MsgBox "No file selected."
        Else
            'Me.Text1 = Dir(.SelectedItems(1))
            Me.Text1 = .SelectedItems(1)
        End If
    End With
    Set objDialog = Nothing

 

 

分享到:
评论

相关推荐

    UE(官方下载)

    This tutorial will show you how to access the information you need in your browser by simply highlighting your text in the edit window and clicking your toolbar button How to install UE3 UE3 is the ...

    Taking the pain out of adding a horizontal scrollbar to a li

    标题“Taking the pain out of adding a horizontal scrollbar to a listbox”指向的就是这样一个问题:如何优雅地为列表框添加水平滚动条,以提升用户体验。这里我们将详细探讨这个主题,并提供一些实践技巧。 ...

    外星人入侵基本版

    《外星人入侵基本版》是一款基于Python编程语言和Pygame库开发的游戏,它为初学者提供了一个良好的学习平台,了解游戏开发的基本概念和技术。在这款游戏中,玩家可以通过控制飞船来抵御外星人的入侵,同时体验到得分...

    google api php client

    1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject: ```php $...

    华为官方固件UPDATE.APP解包打包工具

    Extract the content of the zip to a folder somewhere on your system. Execute HuaweiUpdateExtractor.exe I'm planning to create an installer sometime. Usage Press the browse (...) button and select an...

    UCM RIDC+Component开发文档

    ### UCM RIDC+Component开发概述 #### 一、引言 UCM(Universal Content Management)作为企业级的内容管理系统,在企业信息化建设中扮演着至关重要的角色。本文档旨在为UCM开发人员提供有关RIDC(Repository ...

    iOS 7开发(英文档)

    that is, the file folder and the group folder. In this step (see Figure 1-26), you can also decide whether your class should be included in the target (the executable file). This is usually what you ...

    CE中文版-启点CE过NP中文.exe

    Opening a file and changing bytes do not change them to the file anymore (you need to explicitly save now) Added an option to the processlist to filter out system processes Added a system...

    A tutorial on adding columns to Explorer’s details view via

    标题 "A tutorial on adding columns to Explorer’s details view via" 是一篇关于如何通过列处理程序外壳扩展在Windows资源管理器(Explorer)的详细视图中添加自定义列的教程。这通常涉及到增强Windows操作系统中...

    OutlookAttachView v2.73

    o When adding a folder to scan (with the Add button), the folder path in now delimited with quotes, to ensure that it'll be scanned properly if the folder name contains a comma character. * ...

    VB编程资源大全(英文源码 控制)

    once placed onto a form, makes the form act like the Taskbar (minus the Start Menu)." -- David Newcum<END><br>2 , RemBuilderplus.zip "Rem Builder will auto load on startup to use Rem Builder;...

    Adding a Node to a 10g RAC Cluster

    ### 添加节点到10g RAC 集群 #### 概述 本文档旨在为用户提供一份详尽的指南,帮助其将新节点添加至Oracle 10g Real Applications Clusters (RAC)环境中。该文档适用于数据库管理员(DBAs)和支持分析师等技术人员,...

    TCL TK 语言8.5编程指导

    Creating a button widget 130 Creating a listbox widget 133 Creating an image 139 Creating a simple form 140 Chapter 10: Geometry Management 143 Introduction 143 Controlling layout with the pack ...

    PLSQL.Developer(X64) v12.0.1.1814 主程序+ v11中文包+keygen

    A new Oracle / Output preference has been added to save dbms_output to a file. The filename can include %dbname%, %dbuser% and %date% variables to separate output files based on the database, user and...

    eac3to V3.17

    * fixed: adding subtitle caption count to filenames sometimes didn't work * fixed: subtitle caption counts in log sometimes had wrong track numbers * fixed: all non-supported MKV tracks shared the ...

    lichee_20170502_1607_全志R16的linux系统编译需要改动的文件_使用parrotv1.1的内核_没有外层目录.7z

    libencode-locale-perl libfile-listing-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl ...

    Access 数据转成 SQL 语句,可以导入到任意数据库

    下载本资源后,在命令提示符下用 cscript.exe MDBtoSQLite.vbs <mdb file> 可以将ACCESS数据库转成SQL语句. ' Usage: ' ' cscript.exe MDBtoSQLite.vbs <mdb file> [second mdb file] [...] ' ' Example: cscript ...

Global site tag (gtag.js) - Google Analytics