简单问题何必复杂化呢?
dim ssql as string
dim swh as string
ssql = "SELECT * FROM tbl_表 where True "
swh=""
If isdate(Me.结束日期)=true then swh=swh & " and 日期 <=#" & Me. 结束日期 & "#"
If isdate(Me.开始日期)=true then swh=swh & " and 日期 >=#" & Me. 开始日期 & "#"
If isnull(Me.状态)=false then swh=swh & " and Flag=" & Me.状态
If isnull(Me.厂家)=false then swh=swh & " and 厂家='" & Me.厂家 & "'"
ssql=ssql & swh