Textbox with resoult of looking into a field's query.

  • Thread starter Thread starter MyVi
  • Start date Start date
M

MyVi

Hi,

I have a Query [CAL_RESULTADO] with some columns... [_DIA] & [CODIGO
CLIENTE] and some more. In [_DIA] you will find diferent dates:
31/10/2005. Some of these cells of [_DIA] can be empty.
What I need is to check in [_DIA] to find a specific DATE and in case
of finding a cell with it (for sure it could be more than one cell with
such date, but it does not matter the other, just finding one it is ok,
the other have the same resoult) has to show me in a TextBox of a FORM
the content of [CODIGO CLIENTE].

QUERY --> [CAL_RESULTADO]
------------------------------------
[_DIA] [CODIGO CLIENTE]
10/15/2005 ONE
10/15/2005 ONE
07/25/2005 YOR
11/01/2005 TWO
07/25/2005 YOR
07/25/2005 YOR
------------------------------------
FORM --> [F1]
------------------------------------
[TextBox] --> if [_DIA] = 10/15/2005 then SHOW content of [CODIGO
CLIENTE], so "ONE".
------------------------------------

[F1] is linked with [CAL_RESULTADO]. Then we search into [_DIA] for
date=10/15/2005. The answer it'd be [CODIGO CLIENTE] = ONE. If
date=07/25/2005, answer would be = YOR. And if date= 11/10/2005 the
answer would be = EMPTY or nothing or even to change the color of the
TextBox. We see the answer always into the [TextBox], no matter is the
content of [CODIGO CLIENTE] or (in case [_DIA] has no the date we look
for) we change the propierties of [TextBox] such the Back.color.


I've been trying to do so with the function IIF, but it seems to not
work, due to, it seems IIF just looks for 1 cell of the column [_DIA]
instead of all the cells in [_DIA].

Thanks

Vic
 
Hi,


I would try with a DLookup:


DLookup( "[Codigo Cliente]", "tableNameHere", "[_dia] =
FORMS!FormName!ControlName ")



Hoping it may help,
Vanderghast, Access MVP
 
Thank you Michel.

It worked perfectly. I had to look how.. but it does:

=DLookup("[CODIGO CLIENTE]";"CAL_RESULTADO";"[_DIA]=#31/10/2005# AND
[C_M]<>No")

Thank you.

Vic
 
Back
Top