Access.2007.VBA.Bibl..

(John Hannent) #1

  1. After selecting a text file, click the “Inspect New Jobs from Text File” button to import
    data from the text file to a temporary table, tblNewJobs.
    The code running from this button sets the table as the source object of the Jobs to
    Inspect subform, so you can see the new records before actually appending them to the
    tblJobs table, as shown in Figure 10.13.


FIGURE 10.13
The new jobs imported from a comma-delimited text file.


  1. After inspecting the new data, you can either discard the data or import it into the
    tblJobs table.


nClicking the “Clear Imported Jobs Data” button discards the data (it is not added to
tblJobs).
nClicking the “Save New Jobs to Table” button runs an append query that adds the new
Jobs data to tblJobs. The code does some data type conversion (as shown in Figure
10.14), because all the fields in the text file are text fields.

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf