Results 1 to 11 of 11
  1. #1
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828

    Getting to a list box on subform????

    Hi all,
    I have a primary form with a sub form that I switch tabs on to open different forms and I cant get to this one field for some reason?
    I think I need to call it somehow but here is what I have..
    [CODE]
    [CODE]Private Sub CmdReset_Click()


    ' Call ClearList(Forms!frmProjectHolder!sfrmProjectTeam.F orm!LstMemberRoles)
    End Sub

    Primary Form is frmProjectHolder
    Sub Form is sfrmProjectTeam
    The ListBox is LstMembeRoles which is on a form frmProjecReport
    I beleive there is a way but I cant remember how to enter it??? See Below

    Code:
    Private Sub CmdReset_Click()
    Call ClearList(Forms!frmProjectHolder.sfrmProjectTeam.frmProjecReport.Form!LstMemberRoles)
    End Sub
    Of course this didnt work and would love some assistance in the correct syntax to get this to work please
    The data base is 20mb so I really cant post it without removing most of it, sorry

    Thanks
    Dave

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Is it a single selection list box or multi-select?

    Do you just want to de-select the list or clear it's rowsource?

    Is clearlist() a sub?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    Private Sub CmdReset_Click()
    Call ClearList(Forms!frmProjectHolder.sfrmProjectTeam.f orm.frmProjecReport.Form!LstMemberRoles)
    End Sub

    looks like you are missing a .form

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  5. #5
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Hi all,
    I have tried the following with errors....

    Code:
    Call ClearList(Forms!frmProjectHolder!sfrmProjectTeam.Form!frmProjecReport.Form!LstMemberRoles)
    Error Cant find the field frmProjectReport - Not a field, its a form
    
    
    Call ClearList (Me!sfrmProjectTeam.Form!frmProjecReport.Form!LstMemberRoles)
    Error cant find fiels sfrmProjectTeam - Not a field, its a form

  6. #6
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Call ClearList(Forms!frmProjectHolder.sfrmProjectTeam.F orm.frmProjecReport.Form!LstMemberRoles)

    object define error?

    Not sure why the space is after F orm as that is not how it is when in edit mode! Just on this site\

  7. #7
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Hi Moke
    It a multi select list box
    It has a clear list module to call on, but never had this issue before using it. Works fine and all I can think is it needs to get to a second subform to reconize it?
    Dont know

  8. #8
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Not real sure what I did but got them working?
    So closing this out!
    Thanks all,.
    Dave

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The funky space is thrown in by forum - don't know why. Put text within CODE tags and space won't get thrown in.
    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.

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Quote Originally Posted by d9pierce1 View Post
    Not real sure what I did but got them working?
    So closing this out!
    Thanks all,.
    Dave
    See you back soon then.
    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

  11. #11
    d9pierce1 is offline Expert
    Windows 10 Access 2019
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    828
    Thanks all,
    I deleted all the code for the two buttons and put it back in and it went thru fine and works great?
    Must been a stuborn error of some kind!
    All is good and see ya soon!
    Dave

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

Similar Threads

  1. Replies: 8
    Last Post: 12-13-2017, 10:38 AM
  2. Replies: 3
    Last Post: 11-27-2012, 03:42 PM
  3. Replies: 3
    Last Post: 08-15-2012, 06:48 AM
  4. Replies: 1
    Last Post: 10-22-2010, 10:11 AM
  5. Input data from one list box to another list box
    By KellyR in forum Programming
    Replies: 0
    Last Post: 06-04-2010, 11:24 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