Didn't get to look until after 10 PM but here's what I've got for you thus far: You asked
If I click on search with an empty text box(Text35) it will bring up all the records in the query. I would like the search to show the records only for a single Bldg AFC or BBB when I do this and not see the records from the other buildings. How could I do this to prevent having to make multiple queries and forms and filter this way? I also don't want the user to have to filter themselves with the search button for the building.
Maybe I don't understand the last sentence. You want to search for one building but you don't want to have to use a button? Then change the textbox to a combo
- row source: SELECT DISTINCT BldgAbb, BuildingName FROM tblBuildings;
- width .75"; list width 2.25"; 2 columns: 0.75" and 1.5" wide
- AfterUpdate event:
Me.Filter = "BldgAbb = '" & Me.cmbBldg & "'"
Me.FilterOn = True
Then you don't need the clear or search buttons or any code related to them. This will only allow you to search on one building value, but that is what you asked for. However, if you want the form to open with no records, then you need a different approach as per last paragraph in this post.
STARTUP FORM
I create a 1 pixel bmp image with the same name as the db (Test.bmp) in the db folder. This is supposed to suppress the Access splash screen, but for me it's too fast these days to be sure. Of course, you have to launch the db itself, not Access. Open Access first and of course, you will see the Access splash screen.
Set the startup form to be your splash form. This form gets a Timer property (say, 3 seconds) and a Timer event with
DoCmd.Close
DoCmd.OpenForm "frmSearchAfc"
Splash opens up (use an informative form with things like db title, version number, copyright etc.), stays visible for 3 seconds and main form opens.
If you want this main form to load in the background because it returns lots of records, then use the timer event to open the main form hidden for a period of time, then close the splash, then unhide the main form. Either way, the main form is going to open with all records showing because the combo will be empty at that point. If you want to open it blank and stay that way until a combo value is chosen, you do not set the form recordsource property in the property sheet but instead add code for that in the combo after update event.
Later....