Results 1 to 7 of 7
  1. #1
    mmpboca is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    3

    Text Box Not Updating on Form


    I developed a form that uses multiple DLOOKUPs in text boxes. All of them are automatically updating when the related input combo boxes are updating except for one. I can not figure out why it won't update. It pulls the correct value using DLOOKUP when the form opens based on the value in combobox, but when I change the value in the combobox it doesn't. Any ideas?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    There would have to be a problem with how you've used the value in the combo as part of the DLookup. Without more information, it's impossible to pinpoint the issue, but the evaluation of the lookup probably results in Null. Look for missing quotes in string values coming from the combo, or put a break on the combo AfterUpdate code and check the result of the lookup in the immediate window. If you still can't see it, post what works and what doesn't, but don't just post variables - show the actual values.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    mmpboca is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    3
    If my control source is set as follows: =DLookUp("[tblGenNoofCuts]![fldCutswBleed]","[tblGenNoofCuts]","[tblGenNoofCuts]![fldNoUp]=[Form]![txtEstNoUp]") then it will work one time but won't update every time I change a value in the combobox that is used to drive a DLOOKUP that determines [txtEstNoUp]. I haven't figured out how to refresh the form afterupdate of the combobox because I think this would work.

    I've also tried to use the DLOOKUP that sets [txtEstNoUp] but can't get that to work at all as I get a syntax error. The code I tried for that is as follows: =DLookUp("[tblGenNoofCuts]![fldCutswBleed]","[tblGenNoofCuts]","[tblGenNoofCuts]![fldNoUp]=DLookUp("[tblPCFlatSize]![fldEstNoUp]","[tblPCFlatSize]","[tblPCFlatSize]![fldFlatSize]=""" & [Form]![cboFlatSize] & """")"). I'm thinking this second method just isn't a valid approach.

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Me.recalc will refresh the form


    Sent from my iPhone using Tapatalk

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    The Access Gnomes are very picky about syntax when it comes to entering Control Sources, like this...and I think you're probably confusing them by referring to your Field being looked up incorrectly as well as the Where Clause.

    Instead of

    Code:
    =DLookUp("[tblGenNoofCuts]![fldCutswBleed]","[tblGenNoofCuts]","[tblGenNoofCuts]![fldNoUp]=[Form]![txtEstNoUp]")
    Try, if the Datatype of fldNoUp is Numeric

    Code:
    =DLookUp("[fldCutswBleed]","[tblGenNoofCuts]","fldNoUp = " & [txtEstNoUp])


    Or, if the Datatype of fldNoUp is Text (and it can be, even if made up entirely of digits)

    Code:
    =DLookUp("[fldCutswBleed]","[tblGenNoofCuts]","fldNoUp = '" & [txtEstNoUp] & "'")

    There's no need to refer to the Table that [fldCutswBleed] resides in because the Domain parameter of DLookUp already does that. Likewise, the Control named txtEstNoUp is simply referred to as [txtEstNoUp], as it is on the current Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by mmpboca View Post
    I've also tried to use the DLOOKUP that sets [txtEstNoUp] but can't get that to work at all as I get a syntax error. The code I tried for that is as follows: =DLookUp("[tblGenNoofCuts]![fldCutswBleed]","[tblGenNoofCuts]","[tblGenNoofCuts]![fldNoUp]=DLookUp("[tblPCFlatSize]![fldEstNoUp]","[tblPCFlatSize]","[tblPCFlatSize]![fldFlatSize]=""" & [Form]![cboFlatSize] & """")"). I'm thinking this second method just isn't a valid approach.
    And for this, is "[cboFlatSize]" numeric or text?
    If text, you might try
    Code:
    =DLookUp("[fldCutswBleed]","[tblGenNoofCuts]","[fldNoUp]= " & DLookUp("[fldEstNoUp]","[tblPCFlatSize]","[fldFlatSize]=""" & Me.[cboFlatSize] & """") )
    If numeric, try:
    Code:
    =DLookUp("[fldCutswBleed]","[tblGenNoofCuts]","[fldNoUp]= " & DLookUp("[fldEstNoUp]","[tblPCFlatSize]","[fldFlatSize]=" & Me.[cboFlatSize]))

  7. #7
    mmpboca is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jan 2017
    Posts
    3

    SOLVED! Thanks!

    Thanks for to everyone for the help! I was able to figure out how to refresh the form and get it to work. I'm going to also try some of the other suggestions just so I have a better understanding of how these fickle DLOOKUPs work.

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

Similar Threads

  1. Updating text box in form used as query criteria
    By jmwebster91 in forum Forms
    Replies: 6
    Last Post: 06-20-2016, 09:37 AM
  2. Replies: 7
    Last Post: 10-25-2014, 10:41 AM
  3. Updating form after updating and closing a popup window
    By Historypaul in forum Programming
    Replies: 2
    Last Post: 04-21-2014, 02:13 AM
  4. Replies: 5
    Last Post: 06-03-2013, 09:34 AM
  5. Why is text box not updating?
    By Buakaw in forum Forms
    Replies: 4
    Last Post: 02-28-2011, 04:14 AM

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