Results 1 to 3 of 3
  1. #1
    seeya is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2017
    Posts
    6

    Update form field with query results

    Hi,



    I would like my form frmCampaigns to look up a field Press Release from a query qryPressReleases where Activity ID is the common identifier on both form and query.

    Activity ID is a short text.
    Press Release is a numerical value.

    On frmCampaigns > Press Release Field Property Sheet > Control Source, I've inserted below but it keeps returning an error. Any ideas what I'm doing wrong?

    =DLookUp("Press Release","qryPressReleases","Activity ID = " & Nz("Activity ID",0))

    Thanks in advance
    Seeya

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    You don't need the NZ, if ID is a key.
    keys can never be null.
    BUT you said it was a string so it must have quotes....

    Dlookup("[field]","query","[id]=' " & me.id & "'")

    fields with spaces In the name must have brackets around them.

  3. #3
    seeya is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2017
    Posts
    6
    Quote Originally Posted by ranman256 View Post
    You don't need the NZ, if ID is a key.
    keys can never be null.
    BUT you said it was a string so it must have quotes....

    Dlookup("[field]","query","[id]=' " & me.id & "'")

    fields with spaces In the name must have brackets around them.
    Thanks ranman256. I managed to get it to work!

    =DLookUp("[Press Release]","qryPressReleases","[Activity ID] = '" & [Forms]![frmCampaigns]![Activity ID] & "'")

    Now I've another problem! The value doesn't get updated in my table..which is tblCampaigns. What am I missing again??

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

Similar Threads

  1. Replies: 2
    Last Post: 02-23-2017, 10:46 AM
  2. Replies: 2
    Last Post: 10-27-2016, 06:40 AM
  3. Replies: 1
    Last Post: 07-20-2012, 09:48 AM
  4. Replies: 3
    Last Post: 03-11-2012, 08:24 PM
  5. Query Results are Clickable to Update Form
    By chasemhi in forum Forms
    Replies: 0
    Last Post: 03-24-2011, 08:01 PM

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