Question : outputto naming structure

I have a form in acc2002 that has to following data

Date      Barcode      Reject
20100202      X76U89      -1
20100202      X76U91      0
20100202      X76U94      0
20100202      X76U95      0

All I need is to output this as an .xls file to a directory on the c drive (c:/rejectstatus) using a command button. The name of the file should simply be "rejectstatusYYYYMMDD" where YYYYMMDD equals Date

Answer : outputto naming structure

Private Sub btn_Click()
Dim xlFile As String, qd as dao.querydef
Dim dtable As String
dtable = "SELECT Table1.Barcode, Table1.Reject FROM Table1"

set qd=currentdb.createquerydef("myQuery",dtable)

xlFile = "rejectstatus" & Date
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
        "myquery", "c:\rejectstatus\" & xlFile & ".xls", True

'delete the created query
docmd.deleteObject acQuery,"myQuery"
End Sub
Random Solutions  
 
programming4us programming4us