Results 1 to 4 of 4
  1. #1
    Twinnie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    18

    Display Textbox value based on Combobox selection

    Hello,
    I am designing a Web Database with a bound form to a submit table.
    On the form, I have a combo box with selections that should influence the value to be displayed in a textbox also on same form.
    For instance the combo box for Staff Name contains list of all Staff and I want the textbox to automatically display the level of the staff that was just selected in the combobox.
    I know how to get this done using a combobox but my boss insists that the level should be automatically displayed in the textbox once combobox selection is done.
    Using the combobox for level, I used the select statement in the RowSource property : SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));
    I am in a dilemma of how to replicate this for the textbox because textbox only has control source and no RowSource where I can put this select statement.
    Also, I will still need to bind this textbox to the submit table with the column name "TxtLevel" in the control source
    Please see attached sample access db.
    Also note that I cannot use action queries or VBA because it is a Web database and not a client database.
    Thank you.


    dbnew.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    from the example, I assume the cboBox BOUND COLUMN = 2 (staff name)
    if so,

    Code:
    sub cboBox afterupdate()
       txtBox =  cboBox.column(0)
    end sub

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by ranman256 View Post

    Code:
    sub cboBox afterupdate()
       txtBox =  cboBox.column(0)
    end sub
    You missed this:
    Quote Originally Posted by Twinnie View Post

    ...I cannot use...VBA because it is a Web database...
    First off, for the Textbox on the Form, use The DLookup() function in the Level Control to pull in the Level for the given Staff_Name. Have a look at help and get back if you have a problem.

    Secondly, unless you have an unusual requirement, you do not want to redundantly store the Level in a second Table! If you need to display the Level, later, simply use DLookup() again.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Twinnie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    18
    Hello Missinglinq,

    Thank you for your assistance.

    Dlookup seems not to be available on Access Web Databases; please advise on alternative usage.

    I am really in a fix on how to get this achieved. Newbie cryout I must say.

    Please help.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2014, 01:20 PM
  2. Display image based on combobox selection?
    By 10 Gauge in forum Forms
    Replies: 2
    Last Post: 09-15-2011, 07:42 AM
  3. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 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