Combo Box Selection set to text box input (1 Viewer)

murray83

Games Collector
Local time
Today, 08:51
Joined
Mar 31, 2017
Messages
728
sounds ratehr simple and im sure it is and will look quite foolish when sorted

have tried search on here for this subject but have just found the other way round where the selection in a combo box is shown in a text box

my current setup is as follows

combo box control source a query and on update it displays the information needed in a textbox using the following

Code:
txtChkString = cmbLocation.Column(1)

and so i though that the same would of worked the other way so tried this

Code:
Private Sub txt_Check_String_Input_AfterUpdate()

cmbLocation.Column(0) = txt_Check_String_Input.Value

End Sub

but just debugs on me saying Object Required

all pointers welcome :D
 

Minty

AWF VIP
Local time
Today, 08:51
Joined
Jul 26, 2013
Messages
10,353
You can't set a comboboxes column value, but you can set its bound value.
Code:
Me.cmbLocation = Me.txt_Check_String_Input
 

murray83

Games Collector
Local time
Today, 08:51
Joined
Mar 31, 2017
Messages
728
You can't set a comboboxes column value, but you can set its bound value.
Code:
Me.cmbLocation = Me.txt_Check_String_Input

yes that works fine but all it does is put your text in the combo box, what i want is for the user to just type in the text box and then the combo box will spin round to that location and show information in second text box

reason rather type in text box, the combo box is rather long and dosent show all data it pulls from the query but if you type in the combo box data it dosent show it does work so rather then have some one say 'o this is missing'

thought would have them type it in them selves
 

murray83

Games Collector
Local time
Today, 08:51
Joined
Mar 31, 2017
Messages
728
sorry for the confusion

see attached so as you can see i have two text boxes and the combo is in the middle this will be hidden in from view in the end

so flow i would like is

  1. type in location
  2. Combo Box Updates
  3. Second Text Box shows check string
 

Attachments

  • EX.png
    EX.png
    15.1 KB · Views: 22

Minty

AWF VIP
Local time
Today, 08:51
Joined
Jul 26, 2013
Messages
10,353
If the combo box isn't actually doing anything why do you need it ?

A better way would be to just use a DLookup or a dynamic SQL query to get your value after the update of the first textbox ?

What happens if the value isn't found? A combo won't help you there, whereas you can check for no result with a DLookup or query and give the user some options?
 

murray83

Games Collector
Local time
Today, 08:51
Joined
Mar 31, 2017
Messages
728
the value will be found (*edit as its pulled from the query and have checked :) ) and how would i dlookup as the data is not stored in a table in the database as its pulled from a WMS
 
Last edited:

Minty

AWF VIP
Local time
Today, 08:51
Joined
Jul 26, 2013
Messages
10,353
WMS ?
If the data is available in a combo, then it's available in a query, which means you can search it. I'm still confused.

Maybe take a step back and describe in English the purpose of this form, without getting into database jargon.
 

missinglinq

AWF VIP
Local time
Today, 04:51
Joined
Jun 20, 2003
Messages
6,423
FYI, the code

Code:
Me.cmbLocation = Me.txt_Check_String_Input

doesn't "put your text in the combo box," it moves the Combobox to the line where the Bound Column is equal to txt_Check_String_Input. But as Minty said..."What happens if the value isn't found?"

As Minty also suggested, the Combobox seems useless, for this purpose.

Linq ;0)>
 

murray83

Games Collector
Local time
Today, 08:51
Joined
Mar 31, 2017
Messages
728
Thanks for all ideas but i think your all right and trying to make it to complicated so just gonna stick with the combo box and single text box

thanks all though
 

Users who are viewing this thread

Top Bottom