Results 1 to 9 of 9
  1. #1
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212

    DLookup text box on form shows error

    The DLookup is on a form in which I am creating a record. I then open another form from the first form, creating its record for the first time. When I close out of that form, the field I am looking for with the dlookup has been created, but the first form I opened does not create its record until I close it and reopen it. Until I have done that the field contains #Error and not the value I am looking up. Any ideas on how to suppress the #error in the field. Thanks
    =Format(DLookUp("KAddLines","QPage1AmendTotals","P age3addid=" &Nz([Forms]![FSettlementPage1]![page1ID],0)),"Currency","$0.00")



  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    You've got the format argument twice in the Format() function. Use one or the other.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    Thanks. I now have the format argument correctly and no error in the DLookup.

    However, I still have Error in a field that I am trying to add KAddlines to. Same circumstances, I am entering the form to create a record. I then open another form from the first form, creating its record for the first time. When I close out of that form, the field I am looking for with the dlookup has been created, but the first form I opened does not create its record until I close it and reopen it. Until I have done that the field that I am trying to add KAddlines to says #Error and not the sum of some fields plus KAddLines. Any ideas on how to suppress the #error in the field. Thanks

  4. #4
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    I have finally made it work. When I go into the first form, I open and close it twice, this creating the record. When I go into the second form (from the first form), add data, close it, close and open the first form, it shows me the data just entered into the second form. This seems a bit contorted but it works.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Glad you got it working. You should be able to force a record save with:

    If Me.Dirty Then Me.Dirty = False

    and you can use Requery on the first form to get it to show the data from the second.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    Thanks for the response. It is appreciated.

    I have changed the code so that when I return to the first form from either the second or third form, I do a requery, and that seems to be working fine.

    Would you put the If Me.Dirty Then Me.Dirty = False on the After Insert or After Update property of the first form, or both.

    I'm assuming it is a better method that the open close, open close.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    I would think it's already saved at those points, but wherever you're doing the close/open.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Abacus1234 is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    212
    Thanks for your help.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    No problem.
    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. Replies: 1
    Last Post: 04-09-2015, 05:13 PM
  2. Replies: 11
    Last Post: 10-28-2014, 10:39 AM
  3. Lookup field shows ID # and not text
    By kelkan in forum Forms
    Replies: 3
    Last Post: 01-26-2013, 09:19 PM
  4. Text box shows ID field and not the Name
    By jzacharias in forum Access
    Replies: 5
    Last Post: 10-18-2012, 10:24 AM
  5. Dlookup in form returns #error
    By RickM in forum Access
    Replies: 1
    Last Post: 03-29-2010, 07:59 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