R
Richard
I'm having trouble writing a macro that adds a primary key when importing
text data.
When I import the same data manually (File/Import ... ) Access adds a
primary key.
However, when I do the same import using a macro, no primary key is added.
Here is the macro I'm using to import the tab-delimited text data:
Sub ImportTabDelimitedFiles()
Dim strComdocs
' set strFERS to location of My Documents\CRREL-FERS
Dim oShell, oSpecialFolders
Set oShell = CreateObject("WScript.Shell")
Set oSpecialFolders = oShell.SpecialFolders
strComdocs = oSpecialFolders("MyDocuments") & "\Discoverer\ERDC_comdocs\"
DoCmd.TransferText acImportDelim, "ERDC_comdocs_current Import
Specification", _
"ERDC_comdocs_both_in", strComdocs & "ERDC_comdocs_hist.txt"
End Sub
text data.
When I import the same data manually (File/Import ... ) Access adds a
primary key.
However, when I do the same import using a macro, no primary key is added.
Here is the macro I'm using to import the tab-delimited text data:
Sub ImportTabDelimitedFiles()
Dim strComdocs
' set strFERS to location of My Documents\CRREL-FERS
Dim oShell, oSpecialFolders
Set oShell = CreateObject("WScript.Shell")
Set oSpecialFolders = oShell.SpecialFolders
strComdocs = oSpecialFolders("MyDocuments") & "\Discoverer\ERDC_comdocs\"
DoCmd.TransferText acImportDelim, "ERDC_comdocs_current Import
Specification", _
"ERDC_comdocs_both_in", strComdocs & "ERDC_comdocs_hist.txt"
End Sub