Question : Auto Number in Query

How do i input a autonumber within a query? i am creating a query, with a new added field S/N. it will be the so called row number. for instance, query returns 20 rows..... the S/N will be from 1, 2,  3, 4 ...., 20

Can it be done?
Code Snippet:
1:
2:
3:
SELECT "" AS [S/N], ShipmentData.stCountry, ShipmentData.siShipmentReference1, [QV Data].[Manifest Date], ShipmentData.siShipmentReference2, ShipmentData.siShipmentID, ShipmentData.siNumberOfPackages, ShipmentData.siBillableWeight, DateDiff("d",[QV Data].[Manifest Date],[QV Data].[Scheduled Delivery Date]) AS Committed, DateDiff("d",[QV Data].[Manifest Date],[QV Data].[Date Delivered]) AS Actual, [QV Data].[Date Delivered], [QV Data].[Delivery Time], [QV Data].[Signed By], [QV Data].[Exception Description], [QV Data].[Exception Resolution], [QV Data].[Exception Status Description]
FROM ShipmentData INNER JOIN [QV Data] ON ShipmentData.siShipmentID = [QV Data].[Tracking Number]
GROUP BY "", ShipmentData.stCountry, ShipmentData.siShipmentReference1, [QV Data].[Manifest Date], ShipmentData.siShipmentReference2, ShipmentData.siShipmentID, ShipmentData.siNumberOfPackages, ShipmentData.siBillableWeight, [QV Data].[Date Delivered], [QV Data].[Delivery Time], [QV Data].[Signed By], [QV Data].[Exception Description], [QV Data].[Exception Resolution], [QV Data].[Exception Status Description], [QV Data].[Scheduled Delivery Date];
Open in New Window Select All

Answer : Auto Number in Query

Only thing I can think of is running a make table query and then adding an autonumber field to that. Can then export your table to excel.
1:
2:
3:
doCmd.RunSQL "SELECT 'myData' AS aField INTO myNewTable;"
doCmd.RunSQL "ALTER TABLE myNewTable ADD COLUMN myID COUNTER(1,1);"
DoCmd.OutputTo acOutputTable, "myNewTable", acFormatXLS
Open in New Window Select All
Random Solutions  
 
programming4us programming4us