Create a main menu in MS Access with search filtering options to open your forms

Опубликовано: 20 Апрель 2025
на канале: Too Long; Didn't Watch Tutorials
2,646
41

I will show you a few different ways to create some search functions for your MS Access database main menu. The first method will use a macro (easiest) that will prompt you to enter a value, the second approach will use VBA and will prompt you to enter a value, and then third will involve using a textbox and a button to open and filter a form by a specific value or data point.

I haven't created a Microsoft Access video in about a month, so I thought it was overdue. I have noticed that my MS Access videos are among my most popular, so with that in mind, if you have ideas you would like for future videos, please let me know!

VIDEO CHAPTERS ###

Introduction: 0:00
Explanation: 0:06
1st example - use macro to search: 0:50
2nd example - VBA code to prompt you for value: 2:13
3rd example - VBA code to use textbox value and button: 3:31
End Screen: 6:32

CODE EXAMPLES###

First Method (Macro): No Code

Second Method - VBA prompt (I can't include here because it has brackets, which YouTube doesn't permit): https://codefile.io/f/jEnaOHzAmmlU3Es...

Third Method:

Private Sub Command73_Click() ' change the name of Command73 to whatever the name of your button is
Dim newboxvalue As String
Dim strWhere As String

newboxvalue = Forms!mainmenu!textbox.Value
strWhere = "last_name = '" & newboxvalue & "'"

DoCmd.OpenForm "employees", acNormal, , strWhere, acFormEdit, acDialog
Me.textbox = Null 'OPTIONAL: This makes the textbox blank after you submit your request and open the form
End Sub