Results 1 to 2 of 2
  1. #1
    rlsublime is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    58

    VBA for SELECT CASE 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


    Code:
    Private Sub DisplayDelegation_Click()
    Select Case Text28 Is Not Null
    Case True
    Me.Filter = "LOAN_NUMBER = " & Me.Text28
    Me.FilterOn = True
    Me.Requery
    Case False
    End Select
    Select Case Text33 Is Not Null
    Case True
    Me.Filter = "OTHER_LOAN_NUMBER = " & Me.Text33
    Me.FilterOn = True
    Me.Requery
    End Select

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Here is the proper syntax for using Case Select

    Why not just use IF-then-Else

    http://www.techonthenet.com/access/f...anced/case.php

    Alan

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

Similar Threads

  1. select case problem
    By Mclaren in forum Programming
    Replies: 3
    Last Post: 11-17-2011, 01:28 PM
  2. select case or else if for unhiding
    By nichmeg in forum Programming
    Replies: 3
    Last Post: 10-30-2011, 09:30 AM
  3. Select Case vs Dlookup
    By BRV in forum Programming
    Replies: 1
    Last Post: 10-28-2011, 03:18 PM
  4. Help with Select Case statement
    By focosi in forum Access
    Replies: 4
    Last Post: 08-09-2011, 12:01 AM
  5. Logic statement to select report
    By AKQTS in forum Reports
    Replies: 7
    Last Post: 07-30-2010, 12:52 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