Search form

cmray58

Registered User.
Local time
Today, 08:34
Joined
Mar 24, 2014
Messages
70
Hi everyone,

I'm looking for a tutorial on how to build a search function/form. I have a main form that users input data into, but I'd like to build an easier way for them to search other than the embedded Access search field in the nav bar at the bottom.

Essentially, I'd like the user to be able to input DOB, first, and/or last name and have the form return the first record that matches their input. And, of course, if there are no matches, they'll get a dialog box that indicates that.

Thanks!
 
Hi. Not sure where to find "tutorials," but there are plenty of samples you could probably learn from as well, like this one from Allen. I can find more demos, if you like.
 
Hi. Not sure where to find "tutorials," but there are plenty of samples you could probably learn from as well, like this one from Allen. I can find more demos, if you like.

Thanks! I will take a look at this one and give it a shot. It will take me a little while to get to it, so don't think I've forgotten!
 
Thanks! I will take a look at this one and give it a shot. It will take me a little while to get to it, so don't think I've forgotten!
Hi. If you find this particular sample a bit complicated, let me/us know, and I'll try to find other ones for you. Good luck!
 
Hi everyone,

I'm looking for a tutorial on how to build a search function/form. I have a main form that users input data into, but I'd like to build an easier way for them to search other than the embedded Access search field in the nav bar at the bottom.

Essentially, I'd like the user to be able to input DOB, first, and/or last name and have the form return the first record that matches their input. And, of course, if there are no matches, they'll get a dialog box that indicates that.

Thanks!

I frequently use YouTube for instructional videos. Search 'Richard Rost' and browse his stuff. Good luck!
 
Search by date (search boxes with buttons:

Sub Search()

Dim strCriteria, task As String

Me.Refresh

If IsNull(Me.OrderDateFrom) Or IsNull(Me.OrderDateTo) Then

MsgBox "Please enter the date range", vbInformation, "Date Range Required"

Me.OrderDateFrom.SetFocus

Else

strCriteria = "([Date of Service] >= #" & Me.OrderDateFrom & "# And [Date of Service] <= #" & Me.OrderDateTo & "#)"

task = "select * from tblAppointments where (" & strCriteria & ") order by [Date of Service]"

DoCmd.ApplyFilter task

End If

End Sub
 
One thing I employ in all my DBs is the "Outlook Inbox" form. In other words I have a search form with a lot of columns. Above each column is a header. If you click on it, it sorts the list by that column (like in Outlook). If you click again it sorts by that column descending. Unless you have many thousands of records you can usually find what you need. I will admit that I usually use a search feature in conjunction. I posted a generic approach on here, I will see if I can find it.

Example of sortable form.
https://www.access-programmers.co.uk/forums/showpost.php?p=1603913&postcount=76
 

Users who are viewing this thread

Back
Top Bottom