Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13

    list box on form position of records

    I have a form that includes a list box and it is doing all that I want but when the form is displayed, the list box displays all the records and the first record is selected BUT, the first record is not shown. The list box has a scroll bar and it displays many records down and I have to scroll up to get to the first record. I have tried to find a solution but all I can find is how to SELECT the first record. I would just like the text box to show the list starting at the first record from the table. Seems simple but I can't find a solution. Thanks

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    the first record is selected BUT, the first record is not shown.
    I can't see how the first record can be selected and at the same time, not be shown. First thought is to requery the listbox when the form is opened, but that seems like a shot in the dark to me. Perhaps you will get a much faster solution if you post a zipped db copy - see how to attach files at the top of this page. If you wish to try pics instead first, the process is basically the same as posting a db copy because you can't paste pics in a post at this site.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Is the list box bound to the form? Does the sort order of the form and list box match? That will cause this behavior.

    I never use bound list boxes. If this is part of a find first procedure use an unbound list box.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13
    Quote Originally Posted by veale1009 View Post
    I have a form that includes a list box and it is doing all that I want but when the form is displayed, the list box displays all the records and the first record is selected BUT, the first record is not shown. The list box has a scroll bar and it displays many records down and I have to scroll up to get to the first record. I have tried to find a solution but all I can find is how to SELECT the first record. I would just like the text box to show the list starting at the first record from the table. Seems simple but I can't find a solution. Thanks


  5. #5
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    Set the listbox to it's itemdata(0) in the Load of the form.
    No idea why it is doing this, I tested with enough records to get a scrollbar and the first was still visible?

    I would go with the bound theory.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13
    This is what's on the form. The list box data is not positioned to first record. I would like it to be positioned to first record. Sorry for posting procedures as I'm new to this. WWV

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    You cannot just paste pictures on this site. Preview what you post. You need to upload as an attachment.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Obviously my post about pasting pics was of no use.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    To get the listbox and the form to be in sync when the form loads, the sort order for the listbox rowsource must match the sort order of the form recordsource.
    Attached DB also has a combobox to do the lookup for the form.

    veale-davegri-v01.zip

    Click image for larger version. 

Name:	suppliers.png 
Views:	35 
Size:	31.2 KB 
ID:	52226

  11. #11
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13
    The form is used to enter data into the customer table. The form is only used to to update fields based on the record selection from the the list box (which shows all fields). I may have mis spoke that the first record was selected. The form is not sorted, and the list box is sorted based on the RowSource requirements:
    SELECT [Customers].[ID], [Customers].[CUSTORDCLOSD], [Customers].[First Name], [Customers].[Last Name] FROM Customers ORDER BY [ID] DESC;
    Again, the problem is that the list box displays all the records but, it does not display from the first record. I have to scroll up to get to first record. How do I get it to display the record positioned at the first record. Another new question, is there a way to show in the list box only those records that [CUSTORDCLOSD] IS NO, THIS IS A YES/NO FIELD. Thanks WWV

  12. #12
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    is there a way to show in the list box only those records that [CUSTORDCLOSD] IS NO, THIS IS A YES/NO FIELD
    Yes, you use that as criteria for the listbox source.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    Again, the problem is that the list box displays all the records but, it does not display from the first record.
    Repeating the issue, is not helping anyone.

    Is the listbox bound?, sounds like it is.
    I gave you a workaround in post #6, however if the listbox is bound, that is going to change your data in that record.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #14
    veale1009 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2021
    Posts
    13
    Quote Originally Posted by Welshgasman View Post
    Repeating the issue, is not helping anyone.

    Is the listbox bound?, sounds like it is.
    I gave you a workaround in post #6, however if the listbox is bound, that is going to change your data in that record.

    Listbox unbound.

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    Quote Originally Posted by veale1009 View Post
    Listbox unbound.
    So if the listbox is unbound, I cannot see how you cannot be on the first item, unless some code is interfering with the selected entry.
    Upload a sample that DB that shows the issue, otherwise we could be here forever.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 05-11-2024, 03:10 AM
  2. Replies: 1
    Last Post: 07-12-2019, 04:15 PM
  3. Replies: 1
    Last Post: 11-05-2015, 04:16 AM
  4. Replies: 4
    Last Post: 07-04-2013, 12:07 PM
  5. Replies: 3
    Last Post: 03-25-2010, 12:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums