Info Htg

1 Close the connection rst.Close cnn.Close

1 Format the report

FinalRow = Range("A65536").End(xlUp).Row

1 If there were no records, then stop If FinalRow = 1 Then

Application.DisplayAlerts = False WSTemp.Delete

Application.DisplayAlerts = True WSOrig.Activate

MsgBox "There are no transfers to confirm" Exit Sub End If

1 Format column F as a date

Range("F2:F" & FinalRow).NumberFormat = "m/d/y"

' Show the userform - used in next section frmTransConf.Show

1 Delete the temporary sheet Application.DisplayAlerts = False WSTemp.Delete

Application.DisplayAlerts = True

End Sub

The CopyFromRecordSet method copies records that match the SQL query to a range on the worksheet. Note that you receive only the data rows. The headings do not come along automatically. You must use code to write the headings to Row 1. The results are shown in Figure 19.3.

Figure 19.3

Range("A2"). CopyFromRecord Set brought matching records from the Access database to the worksheet.

□ Microsoft Excel - 0ook1

Ble Edit löew Insert Format lools ßata Window ysJp

jLjidi^giai--! - a, s - in ¡im jü 0 B ^*ial
0 0

Post a comment