+ Reply to Thread
Results 1 to 7 of 7

VBA for CASE SELECT logic

  1. #1
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    VBA for CASE SELECT logic

    I currently have the following code linked to a button on my form. I am trying to create a multi-filter. So a user could enter data in Text28 or Text33 and then click the button to run the filter. I tried to set this up with cases to say if text28 is not null then apply filter, and if it is null move on to the next case. Currently, then code is not working. Would I need to define Text28 somewhere in my code. Any idea on how to fix this? Thanks


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA for CASE SELECT logic

    I think IF statement might be easier in your case

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: VBA for CASE SELECT logic

    I actually also have a 3rd criteria which should look at both text 39 and text 41 for values. How would i incorporate this?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA for CASE SELECT logic

    The same logic, but you prob would use ElseIf instead of ELSE

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: VBA for CASE SELECT logic

    Thanks. If the value is not found in the database for any of the text fields,how would I display a message saying value not found in the database?

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA for CASE SELECT logic

    At the end you add
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: VBA for CASE SELECT logic

    Do you have any idea why the bolded/underlined section in the below code is not working? For the Text 39 and Text41 filters, I am trying to get the user to enter values in both fields. The logic is already built, but I am trying to display a message if one field is entered and one is blank, prompting the user that if one is entered, the other should be entered as well for the filter to work. the logic looks correct, but not sure why it is not running. Thanks


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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