DLookUp Criteria (1 Viewer)

rob1

Registered User.
Local time
Today, 13:15
Joined
Jun 7, 2012
Messages
11
Im trying to make an invoice,

Im trying to autofill the products name using a dlookup

The ProductID1(2,3,4 OR 5) is selected from a list in a form and is sourced from "Products!ProductID"

=DLookUp ("Products!PName","Products", where "ProductID1" = "Products!ProductID")

How do i make this work,

Without the "critera" the lookup returns only the 1st record of "Products!PName" for every transaction even though the ProductID1 differs

How to i get it to show the correct corresponding name to ProductID1??

Ive attached a screenshot if that helps at all

:banghead:
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    105.3 KB · Views: 99

bob fitz

AWF VIP
Local time
Today, 13:15
Joined
May 23, 2011
Messages
4,721
Try:
=DLookUp ("PName","Products", "ProductID" = "ProductID1")
 

rob1

Registered User.
Local time
Today, 13:15
Joined
Jun 7, 2012
Messages
11
Try:
=DLookUp ("PName","Products", "ProductID" = "ProductID1")

tried this, it just returns blank boxes in report view?
 

bob fitz

AWF VIP
Local time
Today, 13:15
Joined
May 23, 2011
Messages
4,721
I've just had another look a your screenshot. It looks like "ProductID1" is a combo box. If so, instead of trying to look up with DLookUp, you could get the value in a column of the combo box (if it isn't already there). You could get the column value by using something like:
=ProductID1.Column(1)
You would need to use the appropriate number to get the correct column value.
 

Users who are viewing this thread

Top Bottom