List Box

Haytham

Registered User.
Local time
Today, 12:33
Joined
Jun 27, 2001
Messages
162
Hi All...
In main form, I have a ListBox picking data from table. I have a field in main form called IdNo. How can I link my ListBox to the Field... Here, I can't find Child-Master where we do link them

I mean that I want to display the IdNo connected to the record chosen in the lstbox in a txtbox on the form ??Any idea..:mad: :mad: :mad:
 
Child-Master links are usually used for sub forms.
The access wizard should step you through the process of setting up a listbox.

What are you trying to do with your List Box ? If you are using it to find a record on your form and you are going to do it manually you need to do 2 things.

1.. Set up the row source (Whats displayed in the list box).

2.. Find the record.

To set up a row source select the properties for the listbox and go to the row source field. When you click in this field a small box on the RHS will appear. If you click on this you can build a row source like making a query. It will finish up something like
SELECT tblTrade.TradeID, tblTrade.Trade FROM tblTrade ORDER BY tblTrade.Trade;
This will pick 2 fields from the table and sort them in order.

To find a record you need to put code in the after update event of the listbox:

' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TradeID] = " & Str(Me![ListBoxName])
Me.Bookmark = rs.Bookmark

Hope I'm on the right track.

Dave
 
Hi Dave,
Thank you for reply.
When I put the code in AfterUpdate of my LisbBox I got
Object variable or With block variable not set (Error 91)...

Well, I think I have to misexplain my problem.. My point is when I select a record in my Control, it should get the matching records only in the listbox.
My List displays records of Bill No and Customer Names.
So, when I select Bill No in my control, only selected items bought by the specific Bill No should be viewed.
Thank you again and expecting more help
:confused: :eek: :rolleyes: :mad: :( :o
 

Users who are viewing this thread

Back
Top Bottom