A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using Listbox to find records



 
 
Thread Tools Display Modes
  #1  
Old October 10th, 2006, 06:26 AM posted to microsoft.public.access.forms
John Wirt
external usenet poster
 
Posts: 2
Default Using Listbox to find records

I have a simple form configuration but I cannot make it work. I have
Access 2003.

A Form is bound to a Master List table (IDCode, List item name). Both
fields are included on the form. The list has 3,000 items. IDCode is unique.

A second table contains subitems for each item. A one-to-many
Relationship is defined in the database.

The New Subform wizard was used to create a linked subform on the main
Form. The subform works. It is bound to a table called Transcripts
(IDCode, Subitem name). Changing the main form record number with the
arrows at bottom of screen changes the subitems displayed in the form.
The correct subitems are displayed.

Then I used the ListBox wizard to create a listbox for finding the
record to display. I followed the instruction in Help: "Find a record by
selecting a value from a list." The wizard added this code to the
AfterUpdate event:

Private Sub ListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID_Code] = " & Str(Nz(Me![ListBox], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

The Listbox does not work. When I click (or doubleclick) on a ListBox
item, nothing happens. The first item has a faint, dotted box around it,
but this does not change. Hence the Subform still shows the subitems for
the first record in the Listbox.

What am I doing wrong?

Thanks.

John Wirt
  #2  
Old October 10th, 2006, 09:28 AM posted to microsoft.public.access.forms
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default Using Listbox to find records

Hi John

I can't see anything wrong with the AftterUpdate event.

What is the Row Source Type and the Row Source of the list box ?

--
Wayne
Manchester, England.
Enjoy whatever it is you do


"John Wirt" wrote:

I have a simple form configuration but I cannot make it work. I have
Access 2003.

A Form is bound to a Master List table (IDCode, List item name). Both
fields are included on the form. The list has 3,000 items. IDCode is unique.

A second table contains subitems for each item. A one-to-many
Relationship is defined in the database.

The New Subform wizard was used to create a linked subform on the main
Form. The subform works. It is bound to a table called Transcripts
(IDCode, Subitem name). Changing the main form record number with the
arrows at bottom of screen changes the subitems displayed in the form.
The correct subitems are displayed.

Then I used the ListBox wizard to create a listbox for finding the
record to display. I followed the instruction in Help: "Find a record by
selecting a value from a list." The wizard added this code to the
AfterUpdate event:

Private Sub ListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID_Code] = " & Str(Nz(Me![ListBox], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

The Listbox does not work. When I click (or doubleclick) on a ListBox
item, nothing happens. The first item has a faint, dotted box around it,
but this does not change. Hence the Subform still shows the subitems for
the first record in the Listbox.

What am I doing wrong?

Thanks.

John Wirt

  #3  
Old October 11th, 2006, 04:03 AM posted to microsoft.public.access.forms
John
external usenet poster
 
Posts: 1
Default Using Listbox to find records

The row source is,
SELECT [ELS2002 Master Course List].CSSC_Code, [ELS2002 Master Course
List].[COURSE TITLE] FROM [ELS2002 Master Course List];

These are the correct form and variable names.

The row source type is Table/Query.

Thanks for responding. I cannot figure out why listbox selector for
this simple form/subform does not work.

The link between the Master and Child tables is detemined by a
relationship. Should I base the forms on a query.

John

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.