On Wed, 13 Oct 2010 04:26:05 -0700 (PDT), Ixtreme <(E-Mail Removed)> wrote:
>Somehow I just can't get this to work:
>
>In Access 2002 I have a form and a subform with related records. On
>the subform I want to verify if a field is present in a specific table
>via dlookup. I am only interested in the first 8 characters. The 8
>letter string must be looked up in this table. If not present, color
>the field indicating a value that is not present. I tried everything.
>What I have so far:
>
>IsNull(DLookUp("[Country]"~"SEPA"~"[BIC] = " & Left(Forms![FOT]!
>[FOTP].Form![Party Identifier]~8)")
>
>The table 'SEPA' contains the fields 'Country', 'Name' and 'BIC'
>Example: NETHERLANDS~JP MORGAN CHASE BANK AMSTERDAM~CHASNL2X
>
>The subform contains a field 'Party Identifier'
>Example: 'CHASNL2XXX'
>
>If CHASNL2X is not in table SEPA I would like to have field Party
>Identifier to be in red font.
Your DLookUp expression is incorrect, and I have no idea what you intend.
DLookUp has three arguments: the first is the name of the field to be looked
up; the second is the name of the table or query in which to look; the third
is a valid SQL WHERE clause specifying which record to look up. They're
delimited by commas (or semicolons in some regional settings), not by tildes.
I'm GUESSING that you want:
DLookUp("[Country]", "[SEPA]", "[BIC] = '" &
Left([Forms![FOT]![FOTP].Form![Party Identifier],8) & "'")
This includes a ' delimiter as required for searching text fields.
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also
http://www.utteraccess.com