Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26
  1. #16
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    I would ask 'why not present the user with just the items relevant to them?
    Then no need for highlighting?
    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

  2. #17
    easyrider is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Dec 2021
    Location
    Lancaster County, PA
    Posts
    64
    Sorry for the brief hiatus - had to work. I rebuilt my little testing DB to test the suggestions that have been proposed.

    Here it is. ListBox-PickList Test.zip

    Vlad,

    I've commented out my observations in the ShowAllocatedItems procedures of the two edit user forms (EditUser_F & EditUser2_F). EditUser_F is sorted alphabetically by name and EditUser2_F is sorted by Item_ID (PK). Both can be called from MainForm_F for comparison.

    I also left my original code in this procedure on both edit forms, but it is commented out.

    To summarize:
    1. when the listbox is bound to Item_ID, all items are selected on load and they cannot be selected/deselected
    2. when the list is unbound, the y assignment with DCount throws a run-time error 3075

    Thanks!
    -Bill

  3. #18
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Hi Bill,

    Here is the updated file, sorry for this, I wrote it in Notepad++ so couldn't check, it was missing .ItemData(i) after the Me.ItemList in the dCount.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #19
    easyrider is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Dec 2021
    Location
    Lancaster County, PA
    Posts
    64
    Quote Originally Posted by Gicu View Post
    Hi Bill,

    Here is the updated file, sorry for this, I wrote it in Notepad++ so couldn't check, it was missing .ItemData(i) after the Me.ItemList in the dCount.

    Cheers,
    You are the man!! If I didn't live nearly 3,000 miles away, drinks would be on me. So, until you are better paid, THANK-YOU, THANK-YOU, THANK-YOU!

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    @Gicu,
    How do the next/previous buttons gets enabled/disabled depending on record postion?
    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

  6. #21
    easyrider is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Dec 2021
    Location
    Lancaster County, PA
    Posts
    64
    Quote Originally Posted by Welshgasman View Post
    @Gicu,
    How do the next/previous buttons gets enabled/disabled depending on record postion?
    Welshgasman,

    Probably should another topic here on the forum, but this is what I use:

    ' custom navigation buttons
    Private Sub Form_Current()
    Dim rst As DAO.Recordset
    ' N is the total number of records, C is the pointer to the current record
    Dim n, C As Long

    Set rst = Me.RecordsetClone
    If rst.RecordCount <> 0 Then
    With rst
    .MoveFirst
    .MoveLast
    n = .RecordCount
    End With
    End If

    C = Me.CurrentRecord

    If C = 1 Then
    GoToPrev_BTN.Enabled = False
    GoToFirst_BTN.Enabled = False
    Else
    GoToPrev_BTN.Enabled = True
    GoToFirst_BTN.Enabled = True
    End If
    If C = n Then
    GoToNext_BTN.Enabled = False
    GoToLast_BTN.Enabled = False
    Else
    GoToNext_BTN.Enabled = True
    GoToLast_BTN.Enabled = True
    End If
    rst.Close
    'refresh the listbox after any navigation button is clicked
    Me.ItemList.Requery

    End Sub

    -Bill

  7. #22
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,205
    Re Vlad:
    You are the man!! If I didn't live nearly 3,000 miles away, drinks would be on me. So, until you are better paid, THANK-YOU, THANK-YOU, THANK-YOU!
    You can always send him a donation via his website Home - ForestByteApps
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  8. #23
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    @easyrider
    You're very welcome!

    @Gicu,
    How do the next/previous buttons gets enabled/disabled depending on record postion?
    @Welshgasman : are you talking about the main form (which has the code shown above by Bill) or the two edit forms. Not sure if the sample provided is a true replica of the original db but I would make the two edit forms unbound and remove the built-in navigation buttons like in the attached updated sample.

    @isladogs
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #24
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    What ever form opens at db open.
    There are macroes in there, but no vba, so was curious as to how the buttons know how the buttons get enabled/disabled?
    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

  10. #25
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    MainForm_F opens by default. It has VBA in form OnCurrent event that enables/disables buttons.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #26
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Quote Originally Posted by June7 View Post
    MainForm_F opens by default. It has VBA in form OnCurrent event that enables/disables buttons.
    Damn , sorry. missed that completely.
    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 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. dcount with 2 criteria
    By Nobby2193 in forum Access
    Replies: 2
    Last Post: 02-04-2019, 03:46 AM
  2. Replies: 6
    Last Post: 08-23-2012, 05:06 AM
  3. Replies: 15
    Last Post: 05-24-2012, 02:36 AM
  4. obtain record from report
    By teebumble in forum Reports
    Replies: 3
    Last Post: 07-22-2011, 04:25 PM
  5. Obtain value in record
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 01-20-2011, 08:52 AM

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