[AccessD] Exporting Using Code

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Sep 30 07:18:46 CDT 2004


 I have the following code to export a query into csv file,

 strExcelName = "G3-DE-DJL-25-" & Format(dtStart, "dd-mm-yyyy") & ".csv"
    
 strSQL = "SELECT * INTO " & _
                       "[Text;Database=\\Genesis\Genesis$\Excel_Worksheets\Email\" & strExcelName & "] " & _
                       "FROM qryDailyJobListingForTimer " & _
                       "WHERE (tblBooking.JobDate >= #" & dtStart & "# AND tblBooking.JobDate <= #" & dtFinish & "#) OR " & _
                       "(tblBooking.JobDate < #" & dtStart & "# AND tblBooking.BkgDate >= #" & dtStart & "# AND tblBooking.BkgDate <=#" & dtFinish & "#)"


however when I run it using
 
dbConn.Execute strSQL
 
I get the following error:
 
Run Time Error ‘-2147467259 (80004005)’:
‘qryDailyJobListingForTimer’ is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long
 
I am running this from Visual Basic, the dbConn is the connection to the correct database, I just can’t seem to get it to work, any ideas anyone ?

 Thanks in advance for any help.

 Paul Hartland

-- 

Whatever you Wanadoo:
http://www.wanadoo.co.uk/time/

This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm


More information about the AccessD mailing list