Re: DLookup Help



On Tue, 29 Nov 2005 22:47:48 +0100, AndyEduardo
<AndyEduardo.1za3hy@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>
>I want to say thanks to Allen Browne for his help...
>
>The problem now is as follow....
>
>I have one Form (Invoice) with one subform (Invoice's Details), when I
>select one client in the cbo of the form, the subform's cbo shows only
>the products by agreement.....
>
>Later, I used DLookup function (as Allen Browne recommended) (
>DLookup(expression, domain, [criteria]), but I need to use two
>criterias.....I understanded the terms -expression- and - domain-, and
>they work good, but when I select the product I need two criterias
>because two differents clients can to buy the same product with
>different price.
>then I did a querie with needed fields, and I said to criteria of the
>DLookup function [criteria1] and [criteria2], then Access said (In
>Spanish, sorry) Error 13 No Coinciden los tipos.....
>
>Help me Please

You can only use one criterion - but that criterion can contain
multiple expressions. It should be a valid SQL WHERE clause without
the word WHERE, and it can contain AND (if you want both of two
criteria to apply) or OR (if you want to look up the value if either
one of the criteria applies). For instance you could use

=DLookUp("[Price]", "[PriceList]", "[CustomerID] = " & [CustomerID] &
" AND [ProductID] = " & [ProductID])

This will produce a single string value such as

[CustomerID] = 319 AND ProductID = 44

when the values in the form are inserted.

I have no idea what your table looks like or what criteria you are
trying to use so I can't give a better example. Post with a
description if you need help.

John W. Vinson[MVP]
.



Relevant Pages

  • Re: need help creating criteria for time
    ... Allen Browne - Microsoft MVP. ... I then removed the criteria and left everything else and ran it ... Now let's verify that these date/time fields have *only* date or time, ... If you switch your query to SQL View (View menu, ...
    (microsoft.public.access.queries)
  • Re: need help creating criteria for time
    ... Allen Browne - Microsoft MVP. ... I then removed the criteria and left everything else and ran it ... Now let's verify that these date/time fields have *only* date or time, ... If you switch your query to SQL View (View menu, ...
    (microsoft.public.access.queries)
  • Re: Access Date() & DateAdd functions apparent error in Vista
    ... you might try a compact/repair (Database Utilities on Tools ... Allen Browne - Microsoft MVP. ... This code in both cases was placed inthe criteria grid of the query design ... a calculated field, ...
    (microsoft.public.access.queries)
  • Re: part of multi search query non-functional
    ... solution would be to leave the criteria out of the query, ... Search form - Handle many optional criteria ... Allen Browne - Microsoft MVP. ... Locate the WHERE clause. ...
    (microsoft.public.access.queries)
  • Re: is null and Asterisk wildcard
    ... Eddie Holder wrote: ... Allen Browne - Microsoft MVP. ... I have a form with textboxes which I use as criteria for a query. ...
    (comp.databases.ms-access)