Access.2007.VBA.Bibl..

(John Hannent) #1
When you inspect new job data imported from a Lotus spreadsheet (as shown in Figure 10.22),
the Job Date/Time field looks strange, because the field is created as a Number field. However,
when you click the Save Jobs to Table button, the CDate()function in the qappNewJobs
append query converts the numeric date value into the correct format before appending the data to
tblJobs. This type of tweaking of imported data is often required, to ensure that the data arriving in
the target Access table is the correct data type.

FIGURE 10.22

Numeric values in the Job Date/Time field for data imported from a Lotus 1-2-3 spreadsheet.


The relevant procedures from the Import Job Data from Application File form module are listed
next. The “Clear Imported Jobs Data” button’s event procedure clears the datasheet of records, calls
the SaveAppFileSub, clears the textbox of the file name, and deletes the temporary tables of
new jobs:

Private Sub cmdClearData_Click()

On Error Resume Next

Me![subNewJobs].SourceObject = “”
Call SaveAppFile(“”)
Me![txtSelectedAppFile].Value = “”

Working with External Data 10

Free download pdf