Form Search

cktcPeterson

Member
Local time
Yesterday, 22:55
Joined
Mar 23, 2022
Messages
74
I would like to have a search box that if I type in a word it list out all courses that contain that word.
Example
Search: Miller
List of courses with the word miller.

My next step is to select the course to view the roster.

Any guidance would be great.
 
Lots of ways to do this. Can you show us what you got so far?
 
All I have is a form. Nothing started.

I know how to do it from a combo box and I select the course and it filters the names in a subform.

For this I want to type in the box and hit go, then filter the courses associated with it.
 
All I have is a form. Nothing started.

I know how to do it from a combo box and I select the course and it filters the names in a subform.

For this I want to type in the box and hit go, then filter the courses associated with it.
Can you post the code you're using for your combobox. It would be basically the same with a textbox.
 
I know how to do it from a combo box and I select the course and it filters the names in a subform.
For this I want to type in the box and hit go, then filter the courses associated with it.

To filter a form need to set the filter property and turn the filter on.
example
Me.filter = "CourseName like '*Miller*'"
me.filteron = true

To turn the filter off set the filter to "" and/or set the FilterOn to false.

if you want to filter the subform need to apply the filter to the subform
Me.SubformName.Form.Filter

Code:
Private Sub cmdFilter_Click()
  If cmdFilter.Caption = "Filter" Then
    
     If (txtFilter & "") <> "" Then
       cmdFilter.Caption = "Un Filter"
       With Me.subFrmProducts.Form
         .Filter = "ProductName like '*" & txtFilter & "*'"
         .FilterOn = True
        End With
     End If
  Else
     With Me.subFrmProducts.Form
       .Filter = ""
       .FilterOn = False
      End With
     cmdFilter.Caption = "Filter"
  End If
 
End Sub
 

Attachments

All I have is a form. Nothing started.

I know how to do it from a combo box and I select the course and it filters the names in a subform.

For this I want to type in the box and hit go, then filter the courses associated with it.
So you just compare against the textbox instead of a combo?
 
All I have is a form. Nothing started.

I know how to do it from a combo box and I select the course and it filters the names in a subform.

For this I want to type in the box and hit go, then filter the courses associated with it.
If you know how to do this with a combo box then use one and just set its Limit To List property to 'No' then filter the form using the After Update Event. That way you can either type in the filter criteria OR select it from a drop-down combo box. It works the same way.
 
I think the OP wants a version of cascading combos but with the first one replaced by a textbox. Should be a very easy setup, add the new filtering textbox (txtFilterByWord) to your existing form where you already have the working combo, add a Me.cboSearchCourse.Requery line in the Enter or GotFocus event of the combo (I used the name cboSearchCourse) and set the combo's row source (in design view of the form) to use the textbox:

SELECT CourseID, CourseName From tblCourse WHERE Instr(CourseName, Forms!frmYourForm!txtFilterByWord)>0

Cheers,
 
I was able to do the search and filter how I want.
I have a list box. When I double click on the course I want the subform display the students enrolled.

I have a subform on my main form.

Thanks for everyones guidance.
 
My subform is
BSA _Invoice_Roster_Subform

Both have a have course ID in the query.

If that helps.
 
Readers are asking to see some of the code you have.
Copy the relevant code (or sections of code) and paste directly in the forum with some description of what it is.
It may also help if you provide a sample or description of exactly what you are trying to accomplish in simple, plain English.
 
I used this tutorial
Create a Search Button on your Form in Microsoft Access. Find Button. Filter, FilterOn Properties - Bing video

When I search for a course it filters in a list box. (This works)
I want to double click on the course I want and in a subform it list all the students registered for that course.


1690413241228.png
 
Is your subform linked to the parent form? What links the parent to the subform? - CourseID?
eg
1690423012670.png
 

Users who are viewing this thread

Back
Top Bottom