Ms access MSAccess-运行时错误';438';:对象没有';尝试打开文件时,不支持此属性或方法

Ms access MSAccess-运行时错误';438';:对象没有';尝试打开文件时,不支持此属性或方法,ms-access,compiler-errors,Ms Access,Compiler Errors,我正在尝试处理一个旧的MS ACCESS数据库,但不知道MSAccess。有人能帮我处理以下代码吗 Private Sub Cmd_Directory_Click() Dim Filename1, MyFile, RowSrc, Ext As String Dim MyPos, MyPos1, Length, Dist As Integer 'Set filters. cmDialog1.DialogTitle = "Select the FWD Da

我正在尝试处理一个旧的MS ACCESS数据库,但不知道MSAccess。有人能帮我处理以下代码吗

Private Sub Cmd_Directory_Click()
Dim Filename1, MyFile, RowSrc, Ext As String
Dim MyPos, MyPos1, Length, Dist As Integer
         'Set filters.
        cmDialog1.DialogTitle = "Select the FWD Data Directory"
        cmDialog1.Filters = "All Files (*.*)|*.*|ROAR Header Files (*.hea)|*.hea|"
        'Specify default filter.
        cmDialog1.FilterIndex = 2
        'Display the File Open dialog box.
        cmDialog1.ShowOpen
        Filename1 = cmDialog1.FileName
       If Filename1 = "" Then
       End
       End If
'Filter out the directory
       MyPos1 = 0 'Start after C:\
       Do 'Looping to find last \ in long file names
       MyPos = MyPos1 + 1
       MyPos1 = InStr(MyPos, Filename1, "\", 1)
       Length = MyPos1 - MyPos
       Loop Until MyPos1 = 0
       Length = Len(Filename1)
       Dist = Length - MyPos + 1
       'Get the filename from the file
       'Me!FileName = Left((Right(Filename1, dist)), dist - 4)
       Me.ROARDirectory = Left(Filename1, MyPos - 2)
'Add avalible FWD Files
 
'Get the file extension selected
    If cmDialog1.FilterIndex = 2 Then
        Ext = "\*.hea"
    Else
    End If
 
 
    MyFile = Dir(Me.ROARDirectory & Ext)
    RowSrc = ""
    Do
    Length = Len(MyFile)
    Length = Length - 4
    MyFile = Left(MyFile, Length)
    RowSrc = RowSrc & MyFile & ";"
    ListBox1.RowSource = RowSrc
    MyFile = Dir
    Loop Until MyFile = ""
    
End Sub

Private Sub Cmd_LengthDiscrepancyROARList_Click()

'Views the ROAR Remaining Survey List
  
Forms![frmStartup]!TxtSurveyList.Value = "ROARLengthDiscrepancy"
  
    DoCmd.OpenReport "ProjectSurveyList", acViewPreview

End Sub
它给我下面的错误,我不知道如何修复。 当我尝试单击“浏览到文件”时抛出错误,它不允许我访问任何文件,只是抛出此错误

欢迎提出任何建议。
谢谢。

在哪个代码行发生?不显示已声明和设置的cmDialog对象。错误在
cmDialog1.DialogTitle=“选择FWD数据目录”