& “qryInvoices.ShipCountry, “ _
& “qryInvoices.CustomerID, qryInvoices.CompanyName, “ _
& “qryInvoices.BillToAddress, “ _
& “qryInvoices.BillToCityStateZip, “ _
& “qryInvoices.BillToCountry, “ _
& “qryInvoices.Salesperson, “ _
& “qryInvoices.OrderDate, qryInvoices.RequiredDate, “ _
& “qryInvoices.ShippedDate, qryInvoices.Shipper, “ _
& “qtotInvoiceDetails.SumOfExtendedPrice “ _
& “AS Subtotal, “ _
& “qryInvoices.Freight, [SumOfExtendedPrice] “ _
& “+ [Freight] “ _
& “AS Total INTO tmakInvoice “ _
& “FROM qryInvoices “ _
& “INNER JOIN qtotInvoiceDetails “ _
& “ON qryInvoices.OrderID = “ _
& “qtotInvoiceDetails.OrderID “ _
& “WHERE qryInvoices.OrderID = “ & lngInvoiceNo
appAccess.DoCmd.SetWarnings False
appAccess.DoCmd.RunSQL strSQL
appAccess.DoCmd.OpenReport “rptSingleInvoice”
End IfSet appAccess = NothingWhen this script is run, an input box pops up where you can enter an invoice number, as shown
in Figure 17.16.FIGURE 17.16An input box popped up from a WSH script.
After you enter the invoice number and click OK, a SQL statement is run to create a make-table
query that is part of the record source of rptSingleInvoice, and that report is printed. The report is
shown in Figure 17.17.Creating Standalone Scripts with Windows Script Host 17