访问 2010 VBA 用户定义的类型未使用文件打开对话框定义



我在 VBA 中有一个代码,其中写着 Access 2010 当我单击按钮时,它给我错误说"未定义用户定义的类型"这是我的代码:

Private Sub cmdBrowse_Click()
Dim FileOpenDialog As FileDialog
Set FileOpenDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
Dim db As DAO.Database
Set db = CurrentDb
With FileOpenDialog
    .AllowMultiSelect = False
    .Title = "Select A File To Use As A Logo"
    .Filters.Clear
    .Filters.Add "Images", "*.gif; *.jpg; *.jpeg;*.bmp;*.png"
    .ButtonName = "Use This File"
   If .Show = True Then
      For Each SelectedFile In .SelectedItems
        Dim LogoFile As String
        LogoFile = SelectedFile
        Dim barewabarayate As Recordset
        Set barewabarayate = db.OpenRecordset("barewabarayate")
        With barewabarayate
            .Edit
            barewabarayate.Fields("image_path") = LogoFile
            barewabarayate.Update
          End With
        Next
    End If
    End With
End Sub

同意雷穆的观点;我收到相同的错误,直到我在 Access 2010 中有以下参考:

Microsoft Office 14.0 Object Library

从 VB 代码编辑器中,选择"工具"菜单,然后选择"引用..."

最新更新