use 住宿登记表
if thisform.text1.value = 住宿登记表.旅客姓名
thisform.grid1.recordsource = "select * from 住宿登记表 where 住宿登记表.旅客姓名 = thisform.text1.value into cursor a1"
else
if thisform.text2.value = 住宿登记表.入住日期
thisform.grid1.recordsource = "select * from 住宿登记表 where 住宿登记表.入住日期 = thisform.text2.value into cursor a2"
else
wait "不存在的旅客姓名或住宿日期,请重新输入" window timeout 3
endif
endif
你自己参考修改下就OK了