PC Review


Reply
Thread Tools Rate Thread

Dlookup and Conditional Formatting

 
 
Ixtreme
Guest
Posts: n/a
 
      13th Oct 2010
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.

 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      13th Oct 2010
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
 
Reply With Quote
 
Ixtreme
Guest
Posts: n/a
 
      14th Oct 2010
John, thanks for your answer. What I am trying to do is colour the
'Party Identifier' field on the subform FOTP if the associated country
of this Party Identifier cannot be found in table BIC.

I have Party Identifier = CHASNL2XXX
The table 'SEPA' contains the fields 'Country', 'Name' and 'BIC'
Example: NETHERLANDS~JP MORGAN CHASE BANK AMSTERDAM~CHASNL2X

CHASENL2X( the first 8 characters) can be found in the SEPA table,
hence the field party identifier should not be coloured. If the value
cannot be found, colour the field red.

BTW: I changed the delimiter into a tilde in Setting, Regional
settings.I chenged it back to a comma but it still does not work.



 
Reply With Quote
 
Ixtreme
Guest
Posts: n/a
 
      14th Oct 2010
In fact, it's even less complicated:

If the 8 character value of the field Party Identifier (in the example
CHASNL2X) cannot be found in SEPA table then colour Party identifier
field in red font.

I have in conditon 1 in conditional formatting on field Party
identifier:
isnull(DLookUp("[Country]", "[SEPA]", "[BIC] = '" & Left([Forms![FOT]!
[FOTP].Form![Party Identifier],8) & "'") )

the value is not in the table SEPA and it just does not do anything.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Conditional DLookup/Query problem Monet 138 Microsoft Access Form Coding 1 10th Jul 2009 07:40 PM
DLookup in Conditional Formatting? croy Microsoft Access Forms 4 30th Oct 2007 09:22 PM
DLookup in Conditional Formatting =?Utf-8?B?UmlwcGVy?= Microsoft Access Form Coding 2 14th Jul 2007 12:46 AM
dLookup Conditional Formatting =?Utf-8?B?UmlwcGVy?= Microsoft Access Form Coding 1 29th May 2007 05:59 PM
Repost - conditional DLookup control source =?Utf-8?B?UGF1bCBCLg==?= Microsoft Access Form Coding 2 17th Feb 2005 08:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 PM.