Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Look in a lisbox

Status
Not open for further replies.

Geraldo

Programmer
Mar 18, 2002
37
0
0
PT
i have a text box and a list box and i want to put a value or part of it in the text box a lookup de value in the list box.

if someone out there can help me.

Thanks in advance for any help
 
think you need to clarify a little better.

For putting a value in a textbox from a list box that's rather simple. make the textbox value = the listbox selected value.

eg. txtbox1=lstbox0
placed in the control source of your text box ;-) Cruz'n and Booz'n always.
This post shows what little I do at work.
 
when i put the value in the in the textbox, i want acess to search that value in the listbox.
 
i think you're missing the point of a list box. the reason you have a listbox is so you have Options to choose from, which inturn normally populate or open records, etc.. Searching a listbox doesn't seem very friendly.

your list box should be "ordered" in some manner, based on your table.

i think what you might want instead is to just use a filter without a listbox.

I'm not 100% sure of what your'e trying to achieve, but it does appear to me that you are using a list box in a less than friendly way for a listbox to be used.

I could be wrong, but if you clarify what you are trying to achieve perhaps i could help you, then again.. this might be out of my league. Cruz'n and Booz'n always.
This post shows what little I do at work.
 
I suggest that you have the listbox bound to an existing table. then use the listbox to display the choices, but go to the recordset for the actual value. Sort of like this.
' create a table with your data that you want in the listbox.
' then in the form load place listbox0.rowsource = "SELECT * FROM TABLE"
On a command button next to the listbox do the following.
dim rs as adodb.recordset
dim cn as adodb.connection
set rs = new adodb.recordset
set cn = currentproject.connection

rs.open "SELECT * FROM TABLE",CN,ADOPENSTATIC
ME.TEXT.VALUE = RS!FIELDNAME
RS.CLOSE
CN.CLOSE
SET RS = NOTHING
SET CN = NOTHING

'(TEXTBOX NAME) = (TABLE FIELD NAME)
** IF YOU WANT TO HAVE THE ITEM DISAPPEAR FROM THE LISTBOX, YOU MUST DELETE IT FROM THE TABLE AND INSERT IT AGAIN WHILE REQUERYING THE LISTBOX EACH TIME.
** HOPE THIS HELPS.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top