+ Reply to Thread
Results 1 to 9 of 9

Form with listboxes, command button, subform problem

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    PA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Form with listboxes, command button, subform problem

    I have 11 listboxes on my main form and they are multi-select for user input. After the user inputs what they would like to see on the subform display, they would click the command button and it would take whatever they selected and then look at the recordsource query to use that query to filter by what they selected from the 11 listboxes. My problem is I cannot get it to work. When clicking the command button it does nothing. Here is my code:

    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Form with listboxes, command button, subform problem

    Hi, tmill29,

    where does the local variable strWhere gets filled?

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-16-2014
    Location
    PA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Form with listboxes, command button, subform problem

    Isn't that here?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-16-2014
    Location
    PA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Form with listboxes, command button, subform problem

    Oh no it is here:

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Form with listboxes, command button, subform problem

    Yes, but you have not set any value for the variable strWhere. You have defined it with your Dim statement, but it has no value.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Form with listboxes, command button, subform problem

    Hi, tmill29,

    usually you build a connection to the database, create a recordset from the criteria you choose and copy back to the target - if you work from Excel you would need to add these things in order to work. Simply assigning a SQL-String (to what?) won´t create any result from Excel.

    BTW: maybe attach a sample file of the workbook.

    Ciao,
    Holger

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Form with listboxes, command button, subform problem

    I just noticed that you have no command to run the query after setting the query def.

    Perhaps a DoCmd.OpenQuery or DoCmd.Transferspreadsheet are in order depending on how you wish to see the results.

  8. #8
    Registered User
    Join Date
    01-16-2014
    Location
    PA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Form with listboxes, command button, subform problem

    This is solved. Works great.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Form with listboxes, command button, subform problem

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Enable Command Button if ANY of 4 Listboxes Have a Selection Made
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2014, 02:18 PM
  2. [SOLVED] How to make a Command button run the "FORM" command to fill/populate a table?
    By jrobin7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2012, 12:26 PM
  3. Form - Command Button
    By shugg24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2010, 09:28 AM
  4. Form Command Button Problem..
    By Don in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2006, 09:20 PM
  5. VB's Command Button vs Form's Command Button
    By Ronald Dodge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 09:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1