Create Table As Select Where - 使用当前数据库编译错误
Create Table As Select Where - Compile Error using current Database
尝试通过从 table: [Donation_Data] 中提取所有记录,在现有的非关系数据库中创建一个新的 table: [PickupDonTbl],其中 Pickup Date = current日期。
CREATE TABLE CurrentDb.PickupDonTbl AS SELECT * from Donation_Data WHERE [Pickup Date] = Date()
当我输入代码时,我得到 CurrentDb "highlighted" 和编译错误:Expected:end 错误。
然后我想将此 table 导出到 EXCEL 使用:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PickupDonTbl", "C:\Users\dads\BlindCtr\Donation Data.xlsx", True
(我已经测试了这部分并且它有效)
所有这些代码都是通过一个命令按钮从此数据库中的表单启动的"On Click"
how to set up a query where a visually impaired person could enter a date and "click" resulting in the query run with [Pickup Date] = "date entered" and then automatically export as an EXCEL file
在 Access 中创建名为 "PickupDonQry" 的已保存查询为
PARAMETERS [Enter Pickup Date] DateTime;
SELECT Donation_Data.*
FROM Donation_Data
WHERE (((Donation_Data.[Pickup Date])=[Enter Pickup Date]));
然后只需从您的 VBA 代码中导出该查询
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PickupDonQry", _
"C:\Users\dads\BlindCtr\Donation Data.xlsx", True
Access 会提示输入 "Enter Pickup Date" 参数的值,然后将结果导出到指定的 Excel 文件。
尝试通过从 table: [Donation_Data] 中提取所有记录,在现有的非关系数据库中创建一个新的 table: [PickupDonTbl],其中 Pickup Date = current日期。
CREATE TABLE CurrentDb.PickupDonTbl AS SELECT * from Donation_Data WHERE [Pickup Date] = Date()
当我输入代码时,我得到 CurrentDb "highlighted" 和编译错误:Expected:end 错误。
然后我想将此 table 导出到 EXCEL 使用:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PickupDonTbl", "C:\Users\dads\BlindCtr\Donation Data.xlsx", True
(我已经测试了这部分并且它有效)
所有这些代码都是通过一个命令按钮从此数据库中的表单启动的"On Click"
how to set up a query where a visually impaired person could enter a date and "click" resulting in the query run with [Pickup Date] = "date entered" and then automatically export as an EXCEL file
在 Access 中创建名为 "PickupDonQry" 的已保存查询为
PARAMETERS [Enter Pickup Date] DateTime;
SELECT Donation_Data.*
FROM Donation_Data
WHERE (((Donation_Data.[Pickup Date])=[Enter Pickup Date]));
然后只需从您的 VBA 代码中导出该查询
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "PickupDonQry", _
"C:\Users\dads\BlindCtr\Donation Data.xlsx", True
Access 会提示输入 "Enter Pickup Date" 参数的值,然后将结果导出到指定的 Excel 文件。