Toggling Between List Boxes at the Same Location and Selecting Records in Each List Box 
Author Message
 Toggling Between List Boxes at the Same Location and Selecting Records in Each List Box

I have 2 list boxes, List_PUID and List_Title located on top of one
another. I am using 2 command buttons to toggle between them with code
like the following:

Me.List_Title.Visible = True
Me.List_PUID.Visible = False
Me.List_Title.Requery

I want the user to be able to select a record and have the whole form
display THAT record. I am able to do it with one one list box, but the
other does not work. Here is the code I am using in the Click Event of
the list boxes.

I need to SetFocus to PUID because it is the key field in
tbl_Requirements. List_Title works and List_PUID does not. Help.

Thank you in advance,
Rory Jakes

'+--------------------------+'
Private Sub List_PUID_Click()
'+--------------------------+'

Dim xx As String
Dim VarItm As Variant

For Each VarItm In Me.List_PUID.ItemsSelected

   xx = Me.List_PUID.ItemData(VarItm)

Next VarItm

Me.PUID.SetFocus
DoCmd.FindRecord xx, , False, No, True
DoCmd.FindRecord " ", acEntire, False, acSearchAll, False, acCurrent,
True

End Sub

'+---------------------------+'
Private Sub List_Title_Click()
'+---------------------------+'

Dim yy As String
Dim VarItm As Variant

For Each VarItm In Me.List_Title.ItemsSelected

   yy = Me.List_Title.ItemData(VarItm)

Next VarItm

Me.PUID.SetFocus
DoCmd.FindRecord yy, , False, No, True
DoCmd.FindRecord " ", acEntire, False, acSearchAll, False, acCurrent,
True

End Sub



Wed, 06 Apr 2005 20:37:28 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. list box 2 based on list box 1

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

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

4. List Records of a Database in a Standard List Box

5. List Records of Database in List Box

6. Selecting the last record in a list box

7. Selecting record in a List Box after items rearranged

8. Selecting Items from a multi select list box VC++ 6.0 on W2K

9. Returning location number from a list box

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

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

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


 
Powered by phpBB® Forum Software