Results 1 to 5 of 5
  1. #1
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150

    Search By Combo Box

    Click image for larger version. 

Name:	666666.jpg 
Views:	10 
Size:	4.9 KB 
ID:	31841



    Hi

    Please see above image, When i get the Lecturer_ID from the combo box the Text box below should display the name of the lecturer. How can do this?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,128
    Add the lecturer name as the second column of the combobox row source
    This is Column(1) as numbering starts at zero
    You can hide the column if you wish.

    In the after update event of the combo, add a line

    Code:
    Me.TextboxName=me.Combobox.Column(1)

  3. #3
    Join Date
    Apr 2017
    Posts
    1,776
    Where is the combo placed - on bound or unbound form?

    Why does user need to see Lecturer_ID? Usually combo boxes are used to select an ID displaying some text (p.e. name) instead when the ID is selected and later when the form is displayed. I.e. you have a combo box with label "Lecturer", when you activate it you see a list of lecturer names, you select one of them, and the combo box value is set to selected lecturer's ID. And until the value of combo box is not changed, the name of selected lecturer is displayed.

    Combo boxes are used mainly for following purposes.

    1. You select a value for form field from predefined (in design, or in some table) list of values;

    2. You have a record active in form, and you need to select a value for foreign key in this record. P.e. you need to attach a lecturer to specific course. In this case you set this foreign key as combos ControlSource, then you set a query which returns this foreign key as first column, and according text (p.e. name) as second column (there may be more columns, one is the minimum, but for your case 2 is the right number) as RowSource, set BoundColumn to 1, ColumnCount to 2 and ColumnWidth to "0;2.5" (the 1st column with non-zero width is displayed);

    3. You have a form, and you need to select a specific record (with specific primary key value) to be active in form. You create a combo like in p. 2., but unbound one - i.e. you leave ControlSource property empty. And you have to design an AfterUpdate event to locate a record in form with primary key equal with one selected in combo, and set this record to be active.

  4. #4
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150
    Hi Riders52,

    It worked. Thanks Alot

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,128
    You're welcome but do note the points made by Arvi about using combo boxes

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  2. Replies: 3
    Last Post: 01-04-2015, 06:09 PM
  3. Replies: 7
    Last Post: 08-08-2012, 03:28 PM
  4. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  5. Replies: 4
    Last Post: 08-16-2011, 05: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