looks awesome, but i can't figure it out how to implement in my current db. i copied 3 modules, copied vba code and nothing works, cause i prob. should change something there.Or this one...
The Most Powerful form Filter and Requires almost No Code
NOTE: See updated code below. I recommend using the updated class module that @arnelgp modified. It further simplifies building a search form and addresses some bugs...www.access-programmers.co.uk
probably, but i dont get where i should change itYou need to set the names correctly in the form load?
As no-one had created a video for this particular code, that would be a waste of time.looks awesome, but i can't figure it out how to implement in my current db. i copied 3 modules, copied vba code and nothing works, cause i prob. should change something there.
i'll look youtube some step-by-step solutions.
thanks for advice, already reading itAs no-one had created a video for this particular code, that would be a waste of time.
Allen Browne has a lot of snippets, and one is a search form.
Microsoft Access help, tutorials, examples
Free help and tutorials for Microsoft Access. Tips for beginners and database developers. Downloadable examples and utilities. Flaws, bugs, traps, code, design, queries, forms, reports, version and upgrade information.allenbrowne.com
Private Sub cmdFilter_Click()
Dim strFilter As String
If Me.cboCrew <> "" Then
strFilter = "Crew = " & Me.cboCrew.Column(0)
End If
If Me.cboShip <> "" Then
strFilter = strFilter & " AND Ship = " & Me.cboShip.Column(0)
End If
If Me.cboDate <> "" Then
strFilter = strFilter & " AND [Date] = " & Me.cboDate.Column(0)
End If
If Left(strFilter, 4) = " AND" Then
strFilter = Mid(strFilter, 5)
End If
Me.sfrmLinks.Form.Filter = strFilter
Me.sfrmLinks.Form.FilterOn = True
End Sub
okay, im trying to implement it , but something i must be doing wrong.THis is code that I use in one of my forms, before I found his code
SELECT Tlocations.LocationID, Tlocations.Location
FROM Tlocations
ORDER BY Tlocations.[LocationID];
Private Sub cmdFilter_Click()
Dim strFilter As String
If Me.cbolocation <> "" Then
strFilter = "location = " & Me.cbolocation.Column(0)
End If
If Left(strFilter, 4) = " AND" Then
strFilter = Mid(strFilter, 5)
End If
Me.sfrmLinks.Form.Filter = strFilter
Me.sfrmLinks.Form.FilterOn = True
End Sub
yes, i dont. i never hide it. thats why its hard for me to do anything in access. but i love access. sad drama.you do not understand the code
no, i was thinking about dropdown list.Well you need to press the filter button to run the code?
i thought its vba commands, thats why i didn't change them. changed only cbolocation and that is it. yeah. hard for me. but life isn't that easy. so im keep observing what i can do.and are just copying and hoping for the best
thanks for your suggestion. already looking at itI have several articles on filtering and sorting continuous forms. You could start by looking at this summary article with multiple links to other articles and videos
You Can REALLY Do All That With Forms?
This article provides a summary of various topics that I covered in my presentation to the Access DevCon conference on 19 April 2024. It also provides links to various articles, videos and example apps to accompany each topic.www.isladogs.co.uk
just mainformDo you have a subform as I did, or is it just a mainform.
i havethat code should be in the after update event of the combo
Option Compare Database
Option Explicit
Private Sub cbolocation_AfterUpdate()
Dim strFilter As String
If Me.cbolocation <> "" Then
strFilter = "location = " & Me.cbolocation.Column(0)
End If
End Sub
Private Sub Form_Load()
DoCmd.Maximize
End Sub
in sql view itsWhat is form RecordSource?
SELECT Tmain.RiskID, Tmain.RiskCode, Tmain.riskTitle, Tmain.isActive, Tmain.RiskdueDate, Tmain.RiskDate, Tmain.location, Tmain.locationPricies, Tmain.risktype, Tmain.riskcolor, Tmain.reporter, Tmain.picafter, Tmain.picbefore
FROM Tmain;
yesDoes it have a field named Location?
short textWhat data type is Location?