Results 1 to 4 of 4
  1. #1
    jboeder is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2024
    Posts
    1

    Question Problem with DLookup on Form

    I am trying to get a text box on a form to auto-populate a dollar value based on the selection within the combo box on the form. I keep getting either #Name? or #Error no matter how I structure the control source code.



    =DLookup("Base Pay", "GSPayT", "GSLevelandStepF=" & GSLevelandStepCombo)

    This was my first try but it kept throwing #Name? and I am not sure why. I thought that maybe the problem was that the GSLevelandStepF field was in a different table from the other data so I tried the next code.

    =DLookUp("Base Pay","GSPayT","[EmployeesT]![GSLevelandStepF]=" & [GSLevelandStepCombo])

    It then was only throwing #Error. Probably because I used quotes with brackets, but I don't know how to structure this differently.

    Lastly, I am hoping that the populated value can be added to the EmployeeT table when the form is submitted but I am not sure how to do that either.

  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,652
    GSLevelandStepF has to be a field in GSPayT; is it? I'd try to include the field in the combo's row source and do this:

    https://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    Do not have objects with spaces in the names. Then you have to surround them with [ and ].

    You used them pretty much everywhere except where needed for Base Pay, which I would have called BasePay.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Domain aggregate functions can cause slow performance in queries and on form. Use combobox approach described by pbaldy.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Access Dlookup of a Dlookup Assistance
    By caper in forum Access
    Replies: 3
    Last Post: 08-27-2020, 05:56 PM
  2. DLookup loading form problem
    By cassandragubler@gmail.com in forum Programming
    Replies: 21
    Last Post: 02-24-2020, 06:43 PM
  3. Shortening if / dlookup >0 / then dlookup
    By Jack Russel in forum Modules
    Replies: 1
    Last Post: 02-19-2016, 03:01 PM
  4. Replies: 4
    Last Post: 05-31-2013, 07:00 PM
  5. Form title dlookup problem
    By zoinnk in forum Forms
    Replies: 3
    Last Post: 10-03-2011, 08:40 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