40 ms-access
有谁知道如何修改Microsoft Access 2007或2010中的现有导入规范?在旧版本中,导入向导期间出现了一个高级按钮,允许您选择和编辑现有规范.我不再看到这个功能,但希望它仍然存在,并且刚刚移动到其他地方.
Tim*_*ine 40
我可以使用MS Access 2007在我的机器上使用此功能.
值得一提的是,我正在使用Access 2007 SP1
Kno*_*nox 15
我不相信有直接支持的方式.但是,如果您是绝望的,则在导航选项下,选择显示系统对象.然后在表格列表中,将出现系统表格.这里有两个表:MSysIMEXspecs和MSysIMEXColumns.您将能够编辑导入和导出信息.祝好运!
小智 7
即使在完整版本中,Tim Lentine的答案似乎也是如此.还有一件事我想提一下.
如果您完成导入而不进入"高级..."并保存规范,但您确实在导向结束时保存导入以供重复使用(新功能AFAIK),您将无法返回并编辑规范.它内置于"已保存的导入"中.这可能是诺克斯所指的.
但是,您可以进行部分解决:
小智 5
以下是可用于更改和使用MS Access 2010导入规范的三个函数.第三个子更改现有导入规范的名称.第二个子允许您更改导入规范中的任何xml文本.如果您需要更改列名,数据类型,添加列,更改导入文件位置等,这非常有用.实质上您想要修改现有规范.第一个Sub是一个例程,它允许您调用现有的导入规范,为您尝试导入的特定文件修改它,导入该文件,然后删除修改后的规范,保持导入规范"模板"不变且完好无损.请享用.
Public Sub MyExcelTransfer(myTempTable As String, myPath As String)
On Error GoTo ERR_Handler:
Dim mySpec As ImportExportSpecification
Dim myNewSpec As ImportExportSpecification
Dim x As Integer
For x = 0 To CurrentProject.ImportExportSpecifications.Count - 1
If CurrentProject.ImportExportSpecifications.Item(x).Name = "TemporaryImport" Then
CurrentProject.ImportExportSpecifications.Item("TemporaryImport").Delete
x = CurrentProject.ImportExportSpecifications.Count
End If
Next x
Set mySpec = CurrentProject.ImportExportSpecifications.Item(myTempTable)
CurrentProject.ImportExportSpecifications.Add "TemporaryImport", mySpec.XML
Set myNewSpec = CurrentProject.ImportExportSpecifications.Item("TemporaryImport")
myNewSpec.XML = Replace(myNewSpec.XML, "\\MyComputer\ChangeThis", myPath)
myNewSpec.Execute
myNewSpec.Delete
Set mySpec = Nothing
Set myNewSpec = Nothing
exit_ErrHandler:
For x = 0 To CurrentProject.ImportExportSpecifications.Count - 1
If CurrentProject.ImportExportSpecifications.Item(x).Name = "TemporaryImport" Then
CurrentProject.ImportExportSpecifications.Item("TemporaryImport").Delete
x = CurrentProject.ImportExportSpecifications.Count
End If
Next x
Exit Sub
ERR_Handler:
MsgBox Err.Description
Resume exit_ErrHandler
End Sub
Public Sub fixImportSpecs(myTable As String, strFind As String, strRepl As String)
Dim mySpec As ImportExportSpecification
Set mySpec = CurrentProject.ImportExportSpecifications.Item(myTable)
mySpec.XML = Replace(mySpec.XML, strFind, strRepl)
Set mySpec = Nothing
End Sub
Public Sub MyExcelChangeName(OldName As String, NewName As String)
Dim mySpec As ImportExportSpecification
Dim myNewSpec As ImportExportSpecification
Set mySpec = CurrentProject.ImportExportSpecifications.Item(OldName)
CurrentProject.ImportExportSpecifications.Add NewName, mySpec.XML
mySpec.Delete
Set mySpec = Nothing
Set myNewSpec = Nothing
End Sub
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
156582 次 |
| 最近记录: |