Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10

    Help With DLookup

    Click image for larger version. 
<br /><script async src=
    Name: dbhelp.jpg  Views: 21  Size: 152.1 KB  ID: 31516" class="thumbnail" style="float:CONFIG" />
    This is my first post, so be gentle...

    I've read a lot and searched for an answer to this but, no joy.

    I have a form (data entry) in which I'm trying to include a search box (text). I've gotten most of the way there, but I'm getting a #Type! error in the search box after inputting the DLookup function into the Control Source property.
    Attaching a screenshot. Hope it comes through clear enough.

  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
    See if this helps:

    DLookup Usage Samples

    Don't forget to use your field name, not "Criteria".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    Your suggestion about the "Criteria" was spot on. Now I cannot edit the text to do a search in the box.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Not with a formula in the textbox. Sounds like you want an unbound box for entry, another to display the result. Have you considered a combo box? Particularly if you want the form to fill out with the record. If that's the case, try the combo wizard, choosing the third option, "Find a record...".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    Ah...I'll give that a try

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    I agree with pbaldy on using a combo box, include the tool number and maybe tool name, then when they select it from the combo box field, do a form filter using tool number to display that specific tool info.

  7. #7
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    I'm a noob, so pardon the question...but how do I filter the form on the search box results?

    I've got the combo box in place. It does work.

  8. #8
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    One thing I noticed is that the combo box wizard only allows me 2 options. The 3rd option for finding a record based on the selection is missing.

  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,652
    The form needs to be bound directly to a table to get the third option.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    Now the form does not display any records at all.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Is the record source of the form a table? Did the Data Entry property get changed to Yes?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    That was it. Records showing now.

    On another note...I found a video using a text box to search. Includes a macro to SetFilter by the text entered into the text box after update. I've got it semi-working except when I enter text and hit enter, an "enter Parameter" box pops up. If I enter the same text again, the filter works. How do I get it to take the text entered into the box initially?

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The parameter prompt is Access telling you it can't find something (whatever is specified in the prompt). Perhaps something is spelled wrong? What's the code look like?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    NickS's Avatar
    NickS is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2017
    Location
    Memphis, TN
    Posts
    10
    Code:
    [tblToolPrgsToolNum] Like [txtSearchToolNum]
    Embedded macro set at the After Update for the text box in the Where box. "txtSearchToolNum" is the name of the text box used to type in the search criteria.

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Looks okay, but I don't use macros. Can you attach the db here to play with? Maybe it needs the full reference:

    [tblToolPrgsToolNum] Like Forms!FormName.[txtSearchToolNum]

    replacing with your actual form name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Shortening if / dlookup >0 / then dlookup
    By Jack Russel in forum Modules
    Replies: 1
    Last Post: 02-19-2016, 03:01 PM
  2. DLookup
    By Alex Motilal in forum Programming
    Replies: 2
    Last Post: 04-20-2015, 11:05 PM
  3. DLookUp
    By Subwind in forum Programming
    Replies: 4
    Last Post: 11-29-2013, 12:39 AM
  4. DLookUp
    By ttam73 in forum Forms
    Replies: 3
    Last Post: 10-18-2013, 12:47 AM
  5. Is DLookUp What I should be using?
    By cameronaziz in forum Forms
    Replies: 2
    Last Post: 03-24-2011, 04:29 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