J jasmin_m New member Local time Today, 20:54 Joined Jan 10, 2010 Messages 8 Jan 10, 2010 #1 Dim x As Integer Dim y As Integer x = 1 y = 2 a = DLookup("[field]", "table", _ "[field2] = " & x And "[field3] = " & y) In above example criteia is incorect, how can I write it correct.
Dim x As Integer Dim y As Integer x = 1 y = 2 a = DLookup("[field]", "table", _ "[field2] = " & x And "[field3] = " & y) In above example criteia is incorect, how can I write it correct.
pbaldy Wino Moderator Staff member Local time Today, 11:54 Joined Aug 30, 2003 Messages 36,272 Jan 10, 2010 #2 Only your variables should be outside the quotes. You have the And outside them. Check the example at the bottom here, even though it uses mixed data types: http://www.mvps.org/access/general/gen0018.htm
Only your variables should be outside the quotes. You have the And outside them. Check the example at the bottom here, even though it uses mixed data types: http://www.mvps.org/access/general/gen0018.htm
RuralGuy AWF VIP Local time Today, 12:54 Joined Jul 2, 2005 Messages 13,825 Jan 10, 2010 #3 Try: a = DLookup("[field]", "table", "[field2] = " & x & " And [field3] = " & y) ...the And needed to be in the string.
Try: a = DLookup("[field]", "table", "[field2] = " & x & " And [field3] = " & y) ...the And needed to be in the string.
RuralGuy AWF VIP Local time Today, 12:54 Joined Jul 2, 2005 Messages 13,825 Jan 10, 2010 #4 Darn...you guys in Nevada type too fast.
pbaldy Wino Moderator Staff member Local time Today, 11:54 Joined Aug 30, 2003 Messages 36,272 Jan 10, 2010 #5 It's the higher oxygen content down here at 5,000'.
J jasmin_m New member Local time Today, 20:54 Joined Jan 10, 2010 Messages 8 Jan 10, 2010 #6 Thanks guys
RuralGuy AWF VIP Local time Today, 12:54 Joined Jul 2, 2005 Messages 13,825 Jan 10, 2010 #7 pbaldy said: It's the higher oxygen content down here at 5,000'. Click to expand... And here I thought that was all just hot air!!
pbaldy said: It's the higher oxygen content down here at 5,000'. Click to expand... And here I thought that was all just hot air!!
J jasmin_m New member Local time Today, 20:54 Joined Jan 10, 2010 Messages 8 Jan 11, 2010 #8 Is it posible to use DLookup with two table(domain) example; a = DLookup("[field]", "table1 & table2", "[field2] = " & x & " And [field3] = " & y)
Is it posible to use DLookup with two table(domain) example; a = DLookup("[field]", "table1 & table2", "[field2] = " & x & " And [field3] = " & y)
pbaldy Wino Moderator Staff member Local time Today, 11:54 Joined Aug 30, 2003 Messages 36,272 Jan 11, 2010 #9 To my knowledge, no. If you can create a query that joins the two tables appropriately, you could use the DLookup() against that.
To my knowledge, no. If you can create a query that joins the two tables appropriately, you could use the DLookup() against that.