Results 1 to 5 of 5
  1. #1
    Tuckejam is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Jan 2020
    Posts
    171

    Probablay the most asked question. trying to return a value based on a lookup

    embarrassed to ask because i know it has to be one of the most asked questions but after 2 days i am still unable to solve this problem



    I even found
    =DLookUp("[Job Name]","[tbl_Job's]","[Jobs_ID]=" & [Forms]![frm_Incidents]![Jobs_ID])
    but this just returns the error

    #Type!

    Basically in a form I want to enter a Job Number and have it show me the jobs name.

    to go deeper, I am tracking delays that happen in the shop

    so the main table and forms i have are "tbl_incidents" and "frm_incidents"

    one of the supporting tables I have is "tbl_Jobs" and it has [Jobs_ID], [Jobs #], [Jobs Name]

    but that is one of many things that the "incidents" is pulling in from other from other tables. it also has 'Employees" and "Customers" etc etc etc

    and adding a Job #/name is not even required as not all delays are cause by or belong to a specific Job. but w add a job# I need it to show me the name)

    thanks for the help

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    So what is the data type for [Jobs #] ? If it's text you need to delimit it with single quotation marks.
    Do yourself a favour and eliminate, or at least going forward do not use, special characters like that in any object name (save for possibly underscore character).
    And what is the form control that contains this parameter - a combo, or textbox, or something else? Last but not least, not sure when this is happening. Is it for records where there is no job number?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    1st a gud database id are numeric but we have no numeric fields in form
    dlookup just put a valid # instead the textbox and an invalid # in direct window
    and yes the single quote can be the problem as special character, just remove the ' from the name not realy needed a _

  4. #4
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    299
    Are you sure the name of the table is tbl_Job's?
    Groeten,

    Peter

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    You are not using Job# though, but it's ID?
    The DLookup looks fine to me if ID is actually numeric?
    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

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

Similar Threads

  1. Replies: 2
    Last Post: 03-16-2020, 09:29 AM
  2. Replies: 4
    Last Post: 07-28-2015, 10:14 AM
  3. Replies: 3
    Last Post: 10-23-2013, 01:32 PM
  4. Replies: 7
    Last Post: 04-30-2012, 03:21 PM
  5. Return all fields even if lookup is empty
    By skarden in forum Access
    Replies: 2
    Last Post: 05-11-2011, 10:44 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