1

I've got a table in Access which I'm running a query on. Basically, I've got a control on a form where the user can enter some information. I then want the query to look up any records that are like it (using Like "" & (control) & "" for wildcards), or if the user has not entered anything, look up all the records, including null values.

At the moment I've got this in the expression builder:

IIf([Forms]![frmMint]![cmbSource]<>"",([tblMInt].[fldSource]) Like "*" & [Forms]![frmMint]![cmbSource] & "*",[fldSource])

Here, the [Forms]![frmMint]![cmbSource] is our control, and [fldSource] is our field.

Now, this works - when you type something into the control it will show anything containing the text from our control, as it should, and when you don't it shows everything. BUT it doesn't show any records with null values in our field.

Can anyone help, preferably without having to write SQL? I only say this because I'm going to have to perform this operation on about 20-odd fields too.

4

1 回答 1

0

认为我找到了解决方案,使用...

Like "*" & [Forms]![frmMint]![cmbSource] & "*"

在表达式中,并且...

Source: [fldSource] & " "

在字段中构建一个可以工作的替代字段(确实如此!)。问题是它似乎正在摆脱我为查询构建的格式(只是列宽),但这很容易替换。

于 2013-08-02T09:19:45.343 回答