Expressions inside form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,

I am trying to use this expression to find the matching records from the value entered in the datalabel.
=DLookUp("[GAB/SS#]","[Test Cases]","[GAB/SS#] = Forms![Form1]![datalabel]")

However, it doesn't seem to do anything. Not sure why.

Before, I was using the following query to do the same thing, but if cancel was clicked on the search box it would result in an error.

SELECT [Test Cases].[GAB/SS#], *
FROM [Test Cases]
WHERE ((([Test Cases].[GAB/SS#])=[GAB OR SS#].[value]));

Any help would be appreciated.

Thanks,

Danny
 
Concatenate the value from the text box into the 3rd argument.

If GAB/SS# is a Text type field, surround the value with quotes:
=DLookUp("[GAB/SS#]","[Test Cases]","[GAB/SS#] = """ & [datalabel] & """")

If it is a Number field, you don't need the quotes, but it will error if
there is no number, so use Nz() to handle that situation:
=DLookUp("[GAB/SS#]","[Test Cases]","[GAB/SS#] = " & Nz([datalabel], 0))

For more help on DLookup() see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Danny said:
I am trying to use this expression to find the matching records from the
value entered in the datalabel.
=DLookUp("[GAB/SS#]","[Test Cases]","[GAB/SS#] = Forms![Form1]![datalabel]")

However, it doesn't seem to do anything. Not sure why.

Before, I was using the following query to do the same thing, but if
cancel was clicked on the search box it would result in an error.
SELECT [Test Cases].[GAB/SS#], *
FROM [Test Cases]
WHERE ((([Test Cases].[GAB/SS#])=[GAB OR SS#].[value]));

Any help would be appreciated.

Thanks,

Danny
 
Back
Top