Results 1 to 2 of 2
  1. #1
    Punith Shetty is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2023
    Posts
    1

    Unhappy Dlookup Error


    Hello Guys,

    I am getting an error while doing Dlookup in Unbound form field, I have 2 tables where one table name "Positiondetails" which has columns i.e. "Position_Code" (Short text and primary key) and another is "Positions", another table named "Recruitment Tracker" wherein Form already created from this table and has fields Sr No (primary key Number), Position_Code (Short text), Positions(Short text), I have created relationship one to many from "Positiondetails" table Position_code to "Recruitment Tracker" Position_Code to get drop down in form.

    Postion_code field named as PC1 in form

    However, when I directly did the Dlookup in Positions field (Form) control source it is not working or an Error.

    please help me with this, dont know what i am doing wrong here or let me know if any other method to do lookup in existing form

    =Dlookup("Positions","Positiondetails","Postion_co de=' " & [PC1] & " ' ")

  2. #2
    Join Date
    Apr 2017
    Posts
    1,673
    Why do you need an unbound control in form to display Position at all?

    As start, the table [Recruitment Tracker] (my advice is rename it e.g. as RecruitmentTracker) must have foreign key field Position_Code, but definitely the field Positions is not needed there!
    In form based on table RecruitmentTracker, have a combo box control linked to field Position_Code. Set the RowSource parameter for this combo as "SELECT Position_Code, Positions FROM PositionDetails ORDER BY 2". Set BoundColumn Property of combo as 1 (the value in 1st column of selected row of RowSource query is used as combobox controls selected value), set ColumnWidths property to "0;2,5" or "0,2.5" (I'm not sure here, it may depend on your regional settings) to display Positions value instead of Position_Code, and it is all you need to do with it. When you select the row in form, the combo displays Positions value for this row in combo instead of Position_Code value what is really stored for this row, and is the real value of combobox control. And when the user selects in combo another Positions value for this row, the Position_Code value in table RecruitmentTracker for this row is replaced with code matching with selected Positions value.

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

Similar Threads

  1. Dlookup error $name?
    By buffaloguy in forum Programming
    Replies: 7
    Last Post: 01-18-2019, 04:20 AM
  2. dlookup error
    By slimjen in forum Forms
    Replies: 6
    Last Post: 07-15-2016, 07:57 AM
  3. Dlookup Error
    By PicoTTS in forum Queries
    Replies: 1
    Last Post: 01-27-2016, 02:15 PM
  4. Replies: 2
    Last Post: 01-04-2016, 09:40 AM
  5. DLOOKUP #Error
    By neo651 in forum Forms
    Replies: 6
    Last Post: 12-12-2012, 12:54 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