Results 1 to 10 of 10
  1. #1
    New.User is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37

    Listbox Call Function

    I have two cascading list box listEquipment (row source table) and listSubEquipment (row source value list). When I select a value in listEquipment and click a button (btnAdd), the information is filtered in listSubEquipment. My supervisor wants to eliminate the use of button. So I tried to use the call function (call btnAdd_Click) for "on click" event but it is not working. It is working for "on double click" event though. But I prefer "on click". How do I do this?



    Regards
    New,User

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Try moving your function to the after update event of the list box, assuming it's not a multi-select list box...
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    New.User is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37
    Hello Minty,
    Nope, it is not working for after update event also. The listbox is not multiselect.

  4. #4
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Can you post the code up - both the after update and the button code?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    New.User is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37
    Unfortunately I cannot post it Minty. i apologize for that.

  6. #6
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Just copy it and paste it from the VBA editor - there can't be anything in the VBA code that is sensitive?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Minty is suggesting this, which absolutely should work! Forget about Calling the btnAdd_Click event...simply move your code from btnAdd_Click() to here:

    Code:
    Private Sub listEquipment_AfterUpdate()
      'Code from btnAdd_Click() goes here
    End Sub

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    New.User is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    37
    Thank you Missing Linq and Minty but that didnt work either. Anyways, I spoke to my supervisor and he is Okay with the double click.

    Warm Regards
    New.User

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    @New.User,

    but that didnt work either.
    does not help. I realize you have an agreement with your boss to use the double click, but Minty and 'linq have offered a long established approach. What exactly doesn't work?? This is a forum where experiences are shared and form a basis from which we can all learn.

    Didnt work
    ---doesn't help resolve the issue.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    The only way that placing the code from the OnClick event of btnAdd (that worked, per your original post) in the AfterUpdate event of listEquipment, would be if the Listbox had become corrupted.

    Although we usually think of Forms, and even entire Databases, when we speak of corruption, Controls, such as Listboxes, can and do become corrupted, and seem particularly susceptible to this during app development.

    The test/cure for this is short and simple...delete and then re-create the Control.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Optional argument in function call.
    By Robeen in forum Access
    Replies: 2
    Last Post: 12-06-2016, 04:40 PM
  2. Call function is not executed
    By fluffyvampirekitten in forum Access
    Replies: 12
    Last Post: 11-04-2015, 10:11 AM
  3. call class function from object
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 01-20-2015, 09:51 AM
  4. can't trace function call
    By visions in forum Programming
    Replies: 14
    Last Post: 12-28-2014, 01:24 PM
  5. Call A function
    By aspen in forum Programming
    Replies: 10
    Last Post: 03-16-2014, 12:57 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