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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

relating list boxes and text boxes to tables 1

Status
Not open for further replies.

stevieboy1985

Programmer
Feb 25, 2003
3
GB
i would be very grateful if someone could help me.

I have created a form in access with several text boxes and one list box. I have also created a table. I would like to be able to choose a record from the list box and all the data from the table to be automatically placed into the appropriate labelled text boxes on the form.

Thanks
 
Well, this depends on weather or not you need to update the data. If you do not an easy way to do this is create a procedure for the list box like:

Private Sub List1_Click()

Me.Text1 = Me.List1.Column(1)
Me.Text2 = Me.List1.Column(2)
Me.Text3 = Me.List1.Column(3)
Me.Text4 = Me.List1.Column(4)
Me.Text5 = Me.List1.Column(5)
Me.Text6 = Me.List1.Column(6)
Me.Text7 = Me.List1.Column(7)

End Sub

the list box should have hidden columns with all of the data. Just set the column count to the number of fields you have, place them in order in the query that you use as the Row Source, and set the column widths to something like:

1";0";0";0";0";0";0";0"

I hope this helps.

BAKEMAN [pimp]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top