Subform problem

  • Thread starter Thread starter galaxy
  • Start date Start date
G

galaxy

Guest
I have created an order form and need a subform to put the order details into.

I have created this subform and when you select the product from a combo box, i have created a dlookup to search for the products price.

This code works fine when in the subform on its own, but when I bring it into the main form, I get ?name error.

The subform is called order_item and the main form order.

The code is
=IIf(Forms!Order_Item![Prod#] Is Null,0,DLookUp("[Price_Case]","Wine Stock","[Prod#] =" & Forms!Order_Item![Prod#]))

Any ideas? (or alternatives to dlookup!)
I dont know vba yet but am willing to give anything a go!
 
Use the code below.

=IIf([Forms]![Parent Form]![Order_Item].[Form]![Prod#] Is Null,0,DLookUp("[Price_Case]","Wine Stock","[Prod#] =" & Forms!Order_Item![Prod#]))

Just substitute the name of the parent form.
 
Thanks very much.
Now works a treat!
 

Users who are viewing this thread

Back
Top Bottom