Results 1 to 2 of 2
  1. #1
    luli is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2012
    Posts
    1

    VBA DlookUp problem

    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

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The arguments are strings. Does this help?

    http://access.mvps.org/access/general/gen0018.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DLookup Problem
    By alsoto in forum Queries
    Replies: 5
    Last Post: 02-23-2012, 12:22 PM
  2. Problem with DLookup
    By MichealShinn in forum Programming
    Replies: 5
    Last Post: 01-25-2012, 09:08 AM
  3. DLookup problem
    By the_rock in forum Programming
    Replies: 3
    Last Post: 01-11-2012, 02:36 AM
  4. Dlookup problem
    By metronometro in forum Queries
    Replies: 1
    Last Post: 01-07-2012, 12:17 PM
  5. Using Dlookup problem
    By Lupson2011 in forum Access
    Replies: 5
    Last Post: 12-07-2011, 10:33 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums