简体   繁体   English

无法从 access 2010 代码创建 access 2013 accde

[英]can't create access 2013 accde from access 2010 code

I have an app created in access 2010 64 bit.我有一个在 access 2010 64 位中创建的应用程序。 I have since replaced access 2010 64 bit with access 2013 32 bit on the same PC.从那以后,我在同一台 PC 上用 access 2013 32 bit 替换了 access 2010 64 bit。 The app works fine in both versions of access as an accdb file but when I attempt to create an accde file I receive an error "access unable to create an accde file" - this didn't happen in the access 2010 accde version.该应用程序在作为 accdb 文件的两个版本的访问中都可以正常工作,但是当我尝试创建一个 accde 文件时,我收到一个错误“访问无法创建一个 accde 文件”——这在 access 2010 accde 版本中没有发生。

I plan to distribute the app using access 2013 runtime.我计划使用 access 2013 运行时分发该应用程序。 In one case I thought the problem might be related to late binding but I think that's illogical now.在一种情况下,我认为问题可能与后期绑定有关,但现在我认为这是不合逻辑的。

In the below code the compilation stops at "Dim fldr as Office.FileDialogue" with the message "user defined type not defined" (there is a similar error elsewhere too).在下面的代码中,编译在“Dim fldr as Office.FileDialogue”处停止,并显示消息“未定义用户定义的类型”(其他地方也有类似的错误)。

 Public Function GetFolderName(Optional OpenAt As String) As String

 Dim lCount As Long
 Dim fldr As Office.FileDialog
 Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
 GetFolderName = vbNullString

With fldr

.InitialFileName = OpenAt
.Show
For lCount = 1 To .SelectedItems.Count
    GetFolderName = .SelectedItems(lCount)
Next lCount
End With
End Function

Try this尝试这个

Public Function GetFolderName(Optional OpenAt As String) As String

 Dim lCount As Long
 Dim fldr As Object
 Set fldr = Application.FileDialog(4)
 GetFolderName = vbNullString

With fldr

.InitialFileName = OpenAt
.Show
For lCount = 1 To .SelectedItems.Count
    GetFolderName = .SelectedItems(lCount)
Next lCount
End With
End Function

See this link for the MsoFileDialogType enumeration: https://docs.microsoft.com/en-us/office/vba/api/office.msofiledialogtype有关 MsoFileDialogType 枚举,请参阅此链接: https ://docs.microsoft.com/en-us/office/vba/api/office.msofiledialogtype

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM