Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookUp from SubForm (A2K)

    MainForm Name: frm 15 Inventory
    KeyName: Part_Mstr_SysKey

    SubForm Name: subFormReceiving
    KeyName: Rcvd_SysKey
    Link Master Field: Part_Mstr_SysKey
    Link Child Field: Rcvd_MstSysKey

    This formula in the subform gives me the Cost of the physical previous record

    =DlookUp("[Cost]","qry Received","[Rcvd_SysKey]= " & ([Rcvd_SysKey]-1))

    What I really need is the Cost of the previous record that also matches on Part_Mstr_SysKey

    Any help will, as always, be appreciated
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DLookUp from SubForm (A2K)

    This?

    =DlookUp("[Cost]","qry Received","[Rcvd_SysKey] = " & DMax(["Rcvd_SysKey]","qry Received","[Rcvd_SysKey] < " & [Rcvd_SysKey] & " AND [Rcvd_MstSysKey] = " & [Rcvd_MstSysKey]))

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookUp from SubForm (A2K)

    Hans,

    My apologies for substituting a couple of longer names from the original example, but the following based on your example ( I Hope ) gave me an
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DLookUp from SubForm (A2K)

    It's a simple typo (on my side): change
    <code>
    DMax(["Inv_Rcvd_SysKey]",...
    </code>
    to
    <code>
    DMax("[Inv_Rcvd_SysKey]",...
    </code>
    (quotes before opening square bracket instead of after it)

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookUp from SubForm (A2K)

    Hans,

    Excellent!

    Really, don't you think that Access acts a little picky sometimes? SHE should have known what we meant.

    Please, no hate mail from the feminists. Just kidding.

    Thanks again,
    Cheers,
    Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •