UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Search Box, Access 2010    
 
   
Surico
post Aug 30 2016, 06:45 PM
Post#1



Posts: 47
Joined: 22-August 16



Hi All,

I have an Archive database I am creating and I have a form that allows me to search for files and what I want ideally is the have a text box that people can type into and click on a button to get the results. Is it possible to have this box to allow me to search any amount od fields? Alos if the search brings up no matching results can a message prompt be created to say "Sorry no matching records found"

I currently have the "Access Find" button but I would prefer to have the text box option.

Can anyone help?
Attached File(s)
Attached File  Archive_System.zip ( 194.53K )Number of downloads: 35
 
Go to the top of the page
 
DanielPineault
post Aug 30 2016, 08:22 PM
Post#2


UtterAccess VIP
Posts: 5,450
Joined: 30-June 11



You may wish to look over:

http://www.databasejournal.com/features/ms...-a-Database.htm
http://www.access-programmers.co.UK/forums...ad.php?t=188663


Another approach would be to build a custom WHERE clause for each field in the table, something like:

WHERE [File Barcode] Like "'*" & Eval(Forms![Search for File!txt_SearchTerm) & "*'"
OR [Box Barcode] Like "'*" & Eval(Forms![Search for File!txt_SearchTerm) & "*'"
OR [Client Name] Like "'*" & Eval(Forms![Search for File!txt_SearchTerm) & "*'"
...


Yet another approach could be to concatenate all the fields into one massive field and search it, something like:

WHERE [File Barcode] & [Box Barcode] & [Client Name] ...
LIKE "'*" & Eval(Forms![Search for File!txt_SearchTerm) & "*'"


A preferred method would be to have a txt_SearchTerm textbox as well as a field listing combo box. The user would enter the term to search for as well as select the applicable field to perform the search against. Then things get a little simpler than having to listing/concatenate all the fields.


Lots of options, it all depends on what your needs are exactly.
Go to the top of the page
 
Surico
post Aug 31 2016, 05:11 AM
Post#3



Posts: 47
Joined: 22-August 16



Hi Daniel,

I want it so that if the user types the "Client Name" or the Archive Number" or the "File Barcode" or any of the fields that the search will show all the matching fields.

So for example:

Someone types in the name "John" and presses enter or clicks on the button that the form will show a record with "John" and when the user presses enter again or clicks the button again it will find the next matching record with "John" and if there was no record anywhere of the name "John" then a message box saying something like "Sorry no records found"

Can this be done?

I'm very new to Access and I have no knowledge of how to write code or make code so any help will be much appreciated!!

Thanks smile.gif
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    12th December 2017 - 08:13 PM