Hi! I have a doubt related to programming a dlookup function in VBA (access 2010):
I have a query that sums the total amount per order, i.e. it shows the total amount of all the items in that come from a detailed order table. I created a form based on a table to account for the payments received and what I need is to enter an order and get its total amount to be paid in the following cell of the table (the form is a tabular form).
I wrote the following VBA code:
Code:
Private Sub Ctl__AfterUpdate()
Me.[importe] = DBúsq([totalPorCobrar]![SumaDePrecio Final], [totalPorCobrar], [pagosRecibidos]![N°Pedido] = [totalPorCobrar]![Id])
End Sub
Sorry it's in Spanish. Importe is the field from the form I need to be automatically completed with the total amount of the selected order. "totalPorCobrar" is the query that sums all the totals by order.
The field "importe" is empty after updating, I can't make it work.
Any ideas of what I'm doing wrong?
Thanks a lot in advance!! Regards,
Lucia