Update Text Box from List Box 
Author Message
 Update Text Box from List Box

OK - I've got a regular list box that lists all the items in a particular
field in a database (using a data control).
I've also got a text box bound to a second field in the database.

I know this is simple, but it's been so long since I've done any database
work, I've forgotten how to do it.

How do you click on an item in the list box and have the contents of the
text box change to the corresponding record based on the item you clicked
on?

I've tried data1.recordset.bookmark=list1.text but that doesn't work...

Please...anyone have any answer here?



Thu, 22 Nov 2001 03:00:00 GMT
 Update Text Box from List Box

Have you tried this in the sub list1_click() sub procedure. If not try it!
if so try sub list1_change() sub procedure.  I would also text1.text instead
of data1.re..... = list1.text

--
Sylvio M. LeBlanc
U de M
4e anne Gnie lectrique (Coop)

http://personal.nbnet.nb.ca/sylviol

Quote:
> OK - I've got a regular list box that lists all the items in a particular
> field in a database (using a data control).
> I've also got a text box bound to a second field in the database.

> I know this is simple, but it's been so long since I've done any database
> work, I've forgotten how to do it.

> How do you click on an item in the list box and have the contents of the
> text box change to the corresponding record based on the item you clicked
> on?

> I've tried data1.recordset.bookmark=list1.text but that doesn't work...

> Please...anyone have any answer here?



Thu, 22 Nov 2001 03:00:00 GMT
 Update Text Box from List Box
there is no change event for a list box. and, yes,
I did try the data1.recordset.bookmark=list1.text in the list1.click event.
That's what didn't work.

Any other ideas?

--
David Wier

Quote:

>Have you tried this in the sub list1_click() sub procedure. If not try it!
>if so try sub list1_change() sub procedure.  I would also text1.text
instead
>of data1.re..... = list1.text

>--
>Sylvio M. LeBlanc
>U de M
>4e anne Gnie lectrique (Coop)

>http://personal.nbnet.nb.ca/sylviol


>> OK - I've got a regular list box that lists all the items in a particular
>> field in a database (using a data control).
>> I've also got a text box bound to a second field in the database.

>> I know this is simple, but it's been so long since I've done any database
>> work, I've forgotten how to do it.

>> How do you click on an item in the list box and have the contents of the
>> text box change to the corresponding record based on the item you clicked
>> on?

>> I've tried data1.recordset.bookmark=list1.text but that doesn't work...

>> Please...anyone have any answer here?



Fri, 23 Nov 2001 03:00:00 GMT
 Update Text Box from List Box
David

Try using the find methods of the recordset using the text property of the
listbox. In the following example I'm assuming the listbox is bound to a
field called first name, change this to the appropriate name

data1.recordset.findfirst "FirstName = '" & list1.text & "'"

Note the single quotes they are important. Also look at findnext,
findprevious and findlast.
If performance is an issue look into the seek method and indexes.

Have Fun

Alex


Quote:
> OK - I've got a regular list box that lists all the items in a
particular
> field in a database (using a data control).
> I've also got a text box bound to a second field in the database.

> I know this is simple, but it's been so long since I've done any
database
> work, I've forgotten how to do it.

> How do you click on an item in the list box and have the contents of the
> text box change to the corresponding record based on the item you
clicked
> on?

> I've tried data1.recordset.bookmark=list1.text but that doesn't work...

> Please...anyone have any answer here?



Fri, 30 Nov 2001 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Beginner: Populating text box by selecting from list box

2. List box search based on text box entry...

3. ADO List box and Text boxes

4. Vb 4.0 Problems updating Text Boxes from Combo Box linked to Data Control

5. How do you update text box from combo box

6. Toggling Between List Boxes at the Same Location and Selecting Records in Each List Box

7. list box 2 based on list box 1

8. Updating a combo box list W/limit to list selected

9. Application Role w/Access 2000 combo boxes, list boxes, reports

10. pls help : COMBO box or list box

11. adding to a combo box or list box

12. List box /combo box usage in a DTS VB custom task


 
Powered by phpBB® Forum Software