使用表单在 Access 中搜索多个日期并返回查询时遇到问题

问题描述

所以我有一个客户需要在约会中搜索多个日期。我创建了一个表单,其中的输入设置为捕获其中一个日期并根据输入的日期返回查询

这是桌子设计:

TableDesign

这是表格的样子

FormDesign

提交表单会运行此查询

    SELECT PersonType.Category,Person.FirstName,Person.LastName,Person.dob,Pet.Name,Pet.microchip,Appointment.Cost,Appointment.AppointmentDate,Appointment.[Respite In],Appointment.[Respite Out],Appointment.[Rehome In],Appointment.[Rehome Out],Appointment.[In Date],Appointment.[Out Date],Appointment.[Service Location],Appointment.Note
FROM ((PersonType 
INNER JOIN Person ON PersonType.PersonTypeId = Person.PersonTypeID) INNER JOIN Pet ON Person.PersonID = Pet.PersonID) 
INNER JOIN Appointment ON (Pet.ID = Appointment.PetID) AND (Person.PersonID = Appointment.PersonID)
WHERE (((Appointment.AppointmentDate)>=[Forms]![Search Appointment Dates]![AppointmentDate] And (Appointment.AppointmentDate)<=[Forms]![Search Appointment Dates]![AppointmentEnd]) OR ((Appointment.[Respite In]) = [Forms]![Search Appointment Dates]![RespiteIn]) OR ((Appointment.[Respite Out]) = [Forms]![Search Appointment Dates]![RespiteOut]) OR ((Appointment.[Rehome In]) = [Forms]![Search Appointment Dates]![RehomeIn]) OR ((Appointment.[Rehome Out]) = [Forms]![Search Appointment Dates]![RehomeOut]) OR ((Appointment.[In Date]) = [Forms]![Search Appointment Dates]![InDate]) OR ((Appointment.[Out Date]) = [Forms]![Search Appointment Dates]![OutDate]));

从表单运行查询会导致 3270 错误,尝试打开查询本身会导致以下错误。到目前为止,这比我预期的更令人沮丧,我不确定为什么会发生这种情况或如何使其成功运行。

Error

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)