Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8380643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:30:35+00:00 2026-06-09T16:30:35+00:00

I have a requirement to filter continuous form using string entered or selected from

  • 0

I have a requirement to filter continuous form using string entered or selected from combobox. Below is code I am attempting to use to capture the filter string. What happens is that when text is typed into the list, rather than the string being caught in the back, an error is instead thrown indicating that the combo-box is Null.

Where do I put this functionality? I am thinking of just adding the code to the Combobox_Selected event but that would not give user’s the ability to type arbitrary keywords with which to further filter the content of the form with.

Private Sub txtUSPSKeySearch_Change()
On Error GoTo Err_txtUSPSKeySearch_Change
Dim searchStr As String

               searchStr = txtUSPSKeySearch.Value
                  If (Not IsNull(searchStr) And Len(searchStr) > 1) Then

                  Else

                    ' Move the cursor to the end of the combo box.
  Me.txtUSPSKeySearch.SetFocus
  Me.txtUSPSKeySearch.SelStart = Len(Me.txtUSPSKeySearch.Value)
                 End If

'Error Handling
Exit_txtUSPSKeySearch_Change:
    Exit Sub
Err_txtUSPSKeySearch_Change:
    If Err.Number = 5 Then
         MsgBox "You must make a selection(s) from the list" _
               , , "Selection Required !"
        Resume Exit_txtUSPSKeySearch_Change
    Else
        'Write out the error and exit the sub
        MsgBox Err.Description
        Resume Exit_txtUSPSKeySearch_Change
    End If
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:30:36+00:00Added an answer on June 9, 2026 at 4:30 pm

    “What happens is that when text is typed into the list, rather than the string being caught in the back, an error is instead thrown indicating that the combo-box is Null.“

    You declared that searchStr must be String data type:

    Dim searchStr As String
    

    When txtUSPSKeySearch is Null, this assignment will fail because Null is not string data type.

    searchStr = txtUSPSKeySearch.Value
    

    You could use the Nz() function to give searchStr an empty string when txtUSPSKeySearch is Null:

    searchStr = Nz(Me.txtUSPSKeySearch.Value, vbNullString)
    

    Then you could change the If statement from this …

    If (Not IsNull(searchStr) And Len(searchStr) > 1) Then
    

    to this …

    If Len(searchStr) = 0 Then
    

    You’re doing all this from the txtUSPSKeySearch change event. Consider using the before update event to validate the value, and the after update event to do whatever else (apply the filter condition?) you want to do with a valid value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement where I need to filter out the null values from
In our project we have requirement that, after receiving sms message from third party
I have a requirement like below: We have 20 Message Driven Beans in our
The requirement is following: I have to get the location field from page. var
As a prepossessing requirement of my project I have to remove skin hairs from
I have a requirement and I am not sure if I should use Analysis
I have a requirement to match all the incoming requests and filter out certain
I have requirement where some times I would like to load children as well
I have requirement to disable copy/paste/cut operations on a textbox. For this purpose I
I have requirement, wherein I have to calculate totals for cash and credit cards

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.