Results 1 to 6 of 6
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    Having a textbox display something other that the source data (kinda like a combobox)?

    This might seem a little weird...

    In forms, I show autonumber IDs for users (in case there's a problem) but generally discourage having them mean anything.
    There are times though that I need a user to enter that ID for some reason in an associated form field.
    After they enter that autonumber, I would prefer to display a description for the record with that ID,
    but when they enter back into that textbox for entry, the ID should show again.
    A bit of a toggle display, similar to how combo boxes often hide the actual ID.

    But, we want the saving of the record to see the ID and not the description, or it will throw an error.
    I know sometimes people put a textbox next to the one for entry and DLookup display there, but I want the ID to disappear while just viewing the form, and I just don't have the space for another textbox.

    I thought of laying a "display the description" textbox on top of the "entry textbox" and turning it visible and invisible or pushing it back and front (whatever to allow the entry textbox to work), but maybe there's a better way?

    Has anyone done this with a textbox?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    txtID.visible = false

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    @ranman256, post #2. That would hide everything. I need the description to show instead of the ID.
    Access does this already, in that when you enter a date, you don't see the Double, rather a translation (and the same with all numbers).
    I just don't know what mechanism MS has for us to do the same with our data.

    Pretty standard stuff in most RADs.
    One can't use .text, because that is used to update the source (which we don't want to happen).

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    You could have a text box beneath the description that gains the focus when you click in the description, and holds and displays the number.
    The exit event would move the focus elsewhere , refresh the description and the ID would disappear again, by virtue of being behind the description.

    I use the same technique with combo's where I only want current employees available in the drop down but may need to display older records.
    Can be a bit troublesome on continuous forms, but not unsurmountable.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658
    Quote Originally Posted by Minty View Post
    You could have a text box beneath the description that gains the focus when you click in the description, and holds and displays the number...
    Sounds like the same approach I mentioned in the fourth paragraph of post #1. Or am I missing something?

    Most RAD systems have at least a 4 column array (or 4 properties):
    1. the old data
    2. the entered data
    3. the internal data to be stored
    4. the data to display.

    I'm still getting up to speed on all the properties in Access, and one post in a previous thread of mine, the author mentioned there are many undocumented properties, that have been around for years, so I'm wondering if maybe Access can do this in some way too.

  6. #6
    Edgar is online now Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    Why not a combobox that switches the visible column on, say, double click?
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 14
    Last Post: 12-29-2016, 12:34 AM
  2. Textbox to display combobox value AFTER filtering
    By excellenthelp in forum Forms
    Replies: 12
    Last Post: 12-18-2014, 01:56 PM
  3. Replies: 3
    Last Post: 11-05-2014, 02:43 AM
  4. Replies: 8
    Last Post: 02-28-2014, 10:27 AM
  5. Replies: 8
    Last Post: 12-01-2012, 04:17 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