FIGURE 10.14
An append query that does some data type conversion before appending the newly
imported jobs to the main tblJobs table.
If you clicked the “Save New Jobs to Table” button, the new records that were displayed on the
form were added to tblJobs.
The relevant procedures from the form code module are listed next. The “Clear Imported Jobs”
command button’s event procedure clears the datasheet, calls the SaveTextFileSub procedure,
and clears the previously selected file name from the textbox:
Private Sub cmdClearData_Click()
On Error Resume Next
Me![subNewJobs].SourceObject = “”
Call SaveTextFile(“”)
Me![txtSelectedTextFile].Value = “”
End Sub
Importing data from fixed-width text files has become much more difficult in Access
2007 than in previous versions of Access. Specifications now store the file name inter-
nally, and thus you must create a separate specification for each text file you want to create. This
means that the flexible method I use, where you can select the file to import, will not work. I recom-
mend sticking to comma-delimited file imports, if possible.
NOTENOTE
Working with External Data 10