Results 1 to 5 of 5
  1. #1
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110

    Change textbox from showing PK to showing field value

    Hello all,

    I have a textbox, tboStreetName in sfrmVendorCon that I'm using in a continuous form. The value of this control displays the primary key (StreetID) from my table, tblStreetName. I would like this control to display the text stored in the field StreetName in tblStreetName rather than the primary key.
    I realize I can change the textbox to a combobox and build a simple query, but I don't want to display the control as a text box.

    I'm banging my head against the wall trying to get a DlookUp to work for the Expression Builder, but am having no luck. I've tried several variations, the following is my latest...



    Code:
    =DLookUp("StreetName","tblStreetName","StreetID= " & [Forms]![sfrmVendorCon]![tboStreetNumber])
    I can't seem to find the correct way to write this.
    Please let me know what I'm doing wrong on this DlookUp.

    I'm also curious if a DlookUp may be a poor choice. Will this cause the DB to slow down much running on a continuous form that holds roughly 1K records? If so I would love to hear about better alternatives.

    Thanks for looking,

    John

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Yes, a DLookup() will slow down the form. Can you join the two tables in a query?

  3. #3
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    RuralGuy,

    I hadn't even thought of joining them in a query. I don't have much experience with queries, but am going to see if I can figure it out.

    Thank you for the help.

  4. #4
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    Thank you RuralGuy.

    I was able to make this work using a query. I had not done this before. It was a great learning experience for me.

    Have a great day.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting back with your success.

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

Similar Threads

  1. Showing Mutliple Records in ONE textbox
    By lzook88 in forum Programming
    Replies: 1
    Last Post: 10-20-2015, 07:33 PM
  2. Replies: 15
    Last Post: 04-16-2014, 01:15 PM
  3. Replies: 6
    Last Post: 04-02-2014, 11:35 AM
  4. Field showing =Name?
    By Canadiangal in forum Reports
    Replies: 1
    Last Post: 02-21-2013, 03:02 AM
  5. Showing a selected value from a field
    By Scotlands Lion in forum Access
    Replies: 1
    Last Post: 07-12-2010, 04:04 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