Hello,
I'm trying to export to an excel via vba script that's called in a vbs script.
The underlying query runs a join on two tables with some criteria. The export works when i leave out the last desired field from the WHERE clause.
When I put the last desired WHERE clause in the querie's SQL, I get an error that MS Access was unable to export the data. I think this has to do with the fact that I cast the field in the second table as CINT, since the default type is short text (these tables are file linked automatically updated).
Has anyone ever experienced an issue with Excel exports from queries where one of the query criteria is typecasted?
Here is the query:
Thanks in advance
I'm trying to export to an excel via vba script that's called in a vbs script.
Code:
Public Sub regedRiderUpdateExport()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "reged_rider_update", "C:\Users\Administrator\Desktop\Live Trip Files\studentUpdates\reged_rider_update.xlsx", True
End Sub
The underlying query runs a join on two tables with some criteria. The export works when i leave out the last desired field from the WHERE clause.
When I put the last desired WHERE clause in the querie's SQL, I get an error that MS Access was unable to export the data. I think this has to do with the fact that I cast the field in the second table as CINT, since the default type is short text (these tables are file linked automatically updated).
Has anyone ever experienced an issue with Excel exports from queries where one of the query criteria is typecasted?
Here is the query:
Code:
SELECT sbt_reg_riders.student_id, sbt_reg_riders.last_name, sbt_reg_riders.first_name, sbt_reg_riders.grade, sbt_reg_riders.School_Code, sbt_reg_riders.address, sbt_reg_riders.address2, sbt_reg_riders.city, sbt_reg_riders.zipcode, sbt_reg_riders.Expr1, sbt_reg_riders.homephone, sbt_reg_riders.mailaddress, sbt_reg_riders.resaddress, sbt_reg_riders.isCoupon, sbt_reg_riders.pm_route, sbt_reg_riders.am_route, sbt_reg_riders.am_isspace, sbt_reg_riders.pm_isspace
FROM sbt_reg_riders LEFT JOIN Routefinder_reg_riders ON sbt_reg_riders.student_id = Routefinder_reg_riders.[Local ID]
WHERE ([sbt_reg_riders].[address]<>[Routefinder_reg_riders].[Router Comments])
OR ([sbt_reg_riders].[school_code] <> CINT([Routefinder_reg_riders].[School of Attendance Code]));