Results 1 to 6 of 6
  1. #1
    29ramesh is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    6

    un-usual link in form controls

    Is there any way to link two text boxes to the field of a table?

    That is, i have a field called satisfaction

    i have two text boxes tb1 and tb2
    tb1 is linked with the field satisfaction(Control Source)
    tb2 is linked by dlookup function (control Source)


    when i enter code in tb1, tb2 would display the corresponding value "Good", "Poor","Bad", Worst" etc,

    the requirement is instead of storing the code entered in tb1, i need the value in the tb2 to be stored to the table..

    I hope, my problem is clear..

    Please suggest me the solution..

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    this is what combo boxes are for.
    the combo would have 2 fields,
    1, good
    2, poor
    3, bad

    user picks the 1st column
    txtbox2 can fill with the 2nd column. (no dlookup)
    (note: in VB, columns begin with zero)

    Code:
    sub cboBox_Afterupdate()
       txtBox2 = cboBox.column(1)    'which is actually col 2
    end sub
    this would also run for existing records, in the ON CURRENT event of the form:
    Code:
    sub form_Current()
       
    cboBox_Afterupdate
    end sub

  3. #3
    29ramesh is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    6
    Thank you so much Ranman for your reply. still my problem prevails. the reason is i need to give input in textbox1. based on the input i gave in textbox1, textbox2 should make the label.
    the scenario is for survey data entry. instead of making label entry or mouse click, i want to make numerical entry. The reason is, single numerical data entry would save my data entry time to a large extent. Is there way to achieve it?

  4. #4
    Join Date
    Apr 2017
    Posts
    1,679
    More detailed explanation.

    You have in table e.g. YourTable a field Statistification, which can have values 1, 2 3, ...

    On form, you'll have a control linked to this field. But instead of text box you'll use combo box (when you have a text box there, you can change it to combo box - right-click on control in design mode and change the control type);
    In combo's propreties set Row Source Type to Value List, and into Row source field enter value pairs like 1;"Good";2;"Poor";3"Worst";... (maybe you have to change the delimiter there - depending on your Windows settings);
    Also in combos properties set Column Count to 2 and Column Widths to 0cm;2.5cm

    Now you can on form select Good or Poor or Worst, or start typing and combo offers those selections soon. In form you see texts, but in table are stored according numbers.

  5. #5
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    if you'd like to see both the number and text: set column widths to 1cm;0cm and add a text box with as control source =MyCombobox.column(1)

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by 29ramesh View Post
    when i enter code in tb1, tb2 would display the corresponding value "Good", "Poor","Bad", Worst" etc,

    the requirement is instead of storing the code entered in tb1, i need the value in the tb2 to be stored to the table.
    It sounds to me that the OP is trying to reduce typing and possible misspelling. He wants to type a 1 and have "Best" stored in the table.

    - Could use a combo box with a value list: "Best","Good", "Poor","Bad". Just select the option (best choice).

    - Could use VBA in the after update event to push a value into tb2.

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

Similar Threads

  1. Replies: 11
    Last Post: 04-09-2016, 08:54 PM
  2. Replies: 8
    Last Post: 01-13-2015, 12:23 PM
  3. Replies: 2
    Last Post: 09-18-2012, 09:46 AM
  4. Replies: 4
    Last Post: 08-08-2012, 05:49 PM
  5. Left join not working like usual
    By keyel1971 in forum Access
    Replies: 4
    Last Post: 05-29-2012, 10:12 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