问题描述
在 OpenRecordset方法中解决此错误需要帮助
Need help in resolving this error in a OpenRecordset method
已定义
  ; Dim StartDate As Date
Dim StartDate As Date
Dim TodayDate as Date
Dim TodayDate as Date
设置Rst4 = dbs.OpenRecordset(" SELECT Seminars.Date,Seminars。[Instructor ID] ],研讨会。[研讨会ID],研讨会。[类型ID],研讨会。[城市先生] 来自研讨会WHERE Seminars.Date#StartDate#和#TodayDate #")
Set Rst4 = dbs.OpenRecordset("SELECT Seminars.Date, Seminars.[Instructor ID], Seminars.[Seminar ID], Seminars.[Type ID], Seminars.[Mr City] FROM Seminars WHERE Seminars.Date between #StartDate# And #TodayDate#")
给出语法错误3075错误
然而这很好用
设置Rst4 = dbs.OpenRecordset("SELECT研讨会。[日期],研讨会。[讲师ID],研讨会。[研讨会ID],研讨会。[类型ID],研讨会。[城市先生]
来自研讨会WHERE研讨会。[日期]#10/01/2018#和# 03/11/2011#")
Set Rst4 = dbs.OpenRecordset("SELECT Seminars.[Date], Seminars.[Instructor ID], Seminars.[Seminar ID], Seminars.[Type ID], Seminars.[Mr City] FROM Seminars WHERE Seminars.[Date] between #10/01/2018# And #03/11/2019#")
推荐答案
您好CTolva,
您可以尝试:
Set Rst4 = dbs.OpenRecordset("SELECT Seminars.Date, Seminars.[Instructor ID], Seminars.[Seminar ID], Seminars.[Type ID], Seminars.[Mr City] FROM Seminars WHERE Seminars.Date between #" & StartDate & "# And #" & TodayDate & "#")
用于变量的值而不是其字面值。
to use to value of the variable instead of its literal value.
Imb。
这篇关于当Openrecordset使用条件中的数据时,语法错误3075的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!