Access.2007.VBA.Bibl..

(John Hannent) #1
rng.Value = Nz(rst![OrderID])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Customer])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Employee])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![OrderDate])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![RequiredDate])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShippedDate])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Shipper])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Freight])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipName])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipAddress])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipCity])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipRegion])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipPostalCode])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![ShipCountry])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Product])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![UnitPrice])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Quantity])
Set rng = rng.Offset(columnoffset:=1)
rng.Value = Nz(rst![Discount])

Go to the next row in the worksheet, using the rowoffsetargument:

rst.MoveNext
Set rng = rngStart.Offset(rowoffset:=n)

Next n

Save and close the filled-in worksheet, using a workbook save name with the date range selected in
the dialog:

strSaveName = strDBPath & strSheetTitle & “.xlsx”
Debug.Print “Time sheet save name: “ & strSaveName

Part I The Office Components and What They Do Best

Free download pdf