0

Summary: I want to display a value (in a text box) stored in another form upon choosing specific values from combo boxes. I want to pass the two combo box values I have into the DLoopup property but every time I do so it gives me an error.

Below is the code is inserted in the control source property of a text box:

=DLookUp("[Year_ended]","1_Supportive_Housing","[BudgetYear] ='" & [Combo5] & "'")

This gives me an "#Error" in the text box.

Also tried the following but gives me "#NAME" error:

=DLookUp("[Year_ended]","1_Supportive_Housing","[BudgetYear] = '" & [Combo5.Value] & " And [Program_Name] = '" & [Combo7.Value] & "'")
braX
  • 11,506
  • 5
  • 20
  • 33
Ish
  • 671
  • 5
  • 21
  • 36

1 Answers1

0

You need to get your delimiters sorted out. AFAIR Budget Year is a number:

 =DLookUp("[Year_ended]","1_Supportive_Housing","[BudgetYear] =" & [Combo5])

When you are passing a value to a numeric type field, you do not use delimiters, for text, you use quotes, either 'Abc' or "Abc", for dates, use hash (#) #2012/11/31#.

 =DLookUp("[Year_ended]","1_Supportive_Housing","[BudgetYear] =" & [Combo5]  & " And [Program_Name] = '" & [Combo7.Value] & "'")
Fionnuala
  • 90,370
  • 7
  • 114
  • 152
  • =DLookUp("[Year_ended]","1_Supportive_Housing","[BudgetYear] =" & [Combo5] And [Program_Name] = '" & [Combo7.Value] & "'") – Ish Jun 15 '12 at 18:15
  • BTW, your field (column) names are all over the place. You might like to read http://stackoverflow.com/questions/7662/database-table-and-column-naming-conventions – Fionnuala Jun 15 '12 at 18:21
  • And what had you got against the example I posted? – Fionnuala Jun 15 '12 at 18:57