If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
DLookup Problem
Here is my code. It is returning a type mismatch error and I can't figure out
why. dblPriceToPurchase = DLookup("[dblPriceToPurchaseFactor]", "tblPricing", "[intItem] = " & [intItemID] And "[intVendor] = " & Forms!frmPO![intVendor]) Thanks Terri |
#2
|
|||
|
|||
DLookup Problem
"tgavin" wrote in message
... Here is my code. It is returning a type mismatch error and I can't figure out why. dblPriceToPurchase = DLookup("[dblPriceToPurchaseFactor]", "tblPricing", "[intItem] = " & [intItemID] And "[intVendor] = " & Forms!frmPO![intVendor]) Quotes in the wrong place. Try this: dblPriceToPurchase = _ DLookup("[dblPriceToPurchaseFactor]", "tblPricing", _ "[intItem] = " & [intItemID] & _ " And [intVendor] = " & Forms!frmPO![intVendor]) By the way, you don't actually need all those square brackets ([]) in this case. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#3
|
|||
|
|||
DLookup Problem
On Tue, 4 May 2010 09:15:01 -0700, tgavin wrote:
Here is my code. It is returning a type mismatch error and I can't figure out why. dblPriceToPurchase = DLookup("[dblPriceToPurchaseFactor]", "tblPricing", "[intItem] = " & [intItemID] And "[intVendor] = " & Forms!frmPO![intVendor]) Thanks Terri regarding: = " & [intItemID] And "[intVendor] = " & Forms!etc.. "And" is not the same as & when writing code. dblPriceToPurchase = DLookup("[dblPriceToPurchaseFactor]", "tblPricing", "[intItem] = " & [intItemID] & "And [intVendor] = " & Forms!frmPO![intVendor]) The above assumes both criteria fields are Number datatypes. -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|