Results 1 to 4 of 4
  1. #1
    Buster55 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Dec 2015
    Posts
    20

    Filling a bound text box control on a form with field value from a query

    I am building a database for our police dept. I have a tablecalled “Tbl_Officers”. In this table are fields:
    RPT_OFFICER_DB_ID (autoNumber) (PK)
    OFFICER_LAST_NAME (Text)
    OFFICER_FIRST_NAME (Text)
    OFFICER_ID (Text) Thisis the Identifier that the police dept.gives each officer. Ie. Bagde Number)
    OFFICER_RANK (Number) (Corresponding to another table wherethe number is the PK for each rank)
    LoggedIn (A yes/no field where only 1 officer will be yes aslogged in to the database).

    I have form in the database called: “Frm_UCR_Admin”
    This form is bound to a table named “Tbl_UCR_Administrative”

    In this table are fields:
    RPT_OFFICER_DB_ID (Number) The default for this control, ona new record has to come from the table [Tbl_Officers].[ RPT_OFFICER_DB_ID]where the LoggedIn field is “True”.
    I have accomplished this by creating a select query:
    Here is the sql view of the select query:
    Code:
    SELECT Tbl_Officers.RPT_OFFICER_DB_ID,Tbl_Officer_Rank.OFFICER_RANK_ID, Tbl_Officer_Rank.OFFICER_RANK,Tbl_Officers.RPT_OFFICER, Tbl_Officers.OFFICER_LAST_NAME,Tbl_Officers.OFFICER_FIRST_NAME, Tbl_Officers.OFFICER_ID,Tbl_Officers.OFFICER_PHONE_HOME, Tbl_Officers.OFFICER_PHONE_CELL,Tbl_Officers.OFFICER_START_DATE, Tbl_Officers.OFFICER_CURRENT,Tbl_Officers.OfficerLoginPW, Tbl_Officers.OfficerLoginPWconfirm,Tbl_Officers.EnteredPW, Tbl_Officers.LoggedIn, Tbl_Officers.Active
    FROM Tbl_Officers INNER JOIN Tbl_Officer_Rank ONTbl_Officers.OFFICER_RANK = Tbl_Officer_Rank.OFFICER_RANK_ID
    WHERE (((Tbl_Officers.LoggedIn)=Yes));




    I have set the default property setting for that control as:
    Code:
    =DLookUp("[RPT_OFFICER_DB_ID]","Qry_Officer_LoggedIn")


    This Works

    Now I have to populate the other bound controls with theActual Rank, First Name, Last Name etc. from that same query. The difference isthat the other fields are text and no matter what I put in nothing seems towork for me.

    I know that sounds like a bad idea and redundant data but itreally is the only way as these records must be saved as the Officers name andrank at the time of the report. The officer’s name or rank may change in thefuture but retrieving old records must show the name and rank at the time.

    Here is one of the default property settings that I havetried for the form control [txtRPT_OFFICER_RANK]
    Code:
    =DLookUp("’OFFICER_RANK’","Qry_Officers_LoggedIn")


  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
    Have you tried without those extra quotes around the field?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Buster55 is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Dec 2015
    Posts
    20
    Yes I did. I tried that first and then I decided I needed the extra set of quotes because it was text. I just tried it again and just a blank control.

  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
    The extra quotes would be in the criteria if you had one. I notice the query name is spelled differently in the failing one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 23
    Last Post: 01-27-2016, 01:42 PM
  2. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  3. Form bound control display
    By Daryl2106 in forum Access
    Replies: 5
    Last Post: 12-11-2012, 08:56 AM
  4. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  5. Replies: 1
    Last Post: 06-23-2010, 09:05 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