【问题标题】:Ask for Directory in VB from button click event in Access从 Access 中的按钮单击事件中询问 VB 中的目录
【发布时间】:2015-02-16 22:25:40
【问题描述】:

我是 VB 的新手,所以请原谅我的经验不足。我在 Access 中有一个表单,其中有一个名为“Command17”的按钮。当用户单击按钮时,我需要它要求用户输入目录。这是一个由其他人启动的项目,我在 VB 窗口中看到的只是:

谁能帮忙?

【问题讨论】:

  • 你到现在都做了什么?
  • 我实际上只是接手了这个项目。有人把它给了我说,嘿,我们在星期五之前需要这个。它只有一个带有两个按钮的表单,但是没有任何代码绑定到任何一个按钮。

标签: vba event-handling directory


【解决方案1】:

您需要使用应用程序的目录文件对话框对象并返回路径字符串:

Dim intResult As Integer
Dim strPath As String
intResult = Application.FileDialog(msoFileDialogFolderPicker).Show '<-- show the folder picker
If intResult <> 0 Then '<-- if the user didn't cancel
MsgBox Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1), vbInformation, "Selected Folder" '<--here the selected folder's path that you can use for your scopes
End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    • 1970-01-01
    • 2011-11-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多