I have a wild card search query (Like "*" & [Forms]![search]![Text0] & "*") that works very well. I want to be able to have the phrase that user types in highlighted when it returns the search results on a form. I found the following thread that asks the same question using Conditional formating, but the suggested answer doesn't work. Any ideas?
Hey guys it's been a long time since i've been here but i again need your help
my job asked me if it's possible to have keywords highlighted in search results in report am i clear? meaning, when you search for keywords in one of the fields, and then your results come out in the report, can they be selected, like in Word, or in searches on the Internet, like when doing a search on Monster, all your keywords will come out in red, that way you can easily read the results
I have built a custom search form in a MS Access 2010 database so that users can find specific records to edit. After entering the search criteria and hitting a Search button, another form opens up that shows the search results. This second form includes a command button for generating a report of the search results.
Right now, the custom search form and the search results form are both working properly, but the search results report is showing every record in the database instead of just the search results. This is true whether I access the report via the command button in the form or the navigation pane. I'm not sure if I need to correct my VBA code or the report's properties.
I have a form that acts as a search form where the user inputs a string of text which then updates and filters a list box. For some reason when it does this it highlights the 2nd row on that list, even if there is no data there. How can I get it to automatically highlight the first row? The database is attached and the form in question is FRM_SearchMulti.
I have a form that has a subform on it. The main form shows a category of furniture and has custom navigation buttons and a search text box for asset numbers and command button that runs the search. The subform shows the asset numbers associated with that furniture category, sometimes there is only one asset number, in other cases there could be 60. There is a scroll bar to scroll through the asset numbers when there are too many to see in the initial window.
The buttons all work as they should except when I search for an asset number that is part of a category that has too many asset numbers to show in the main window. When this happens the "previous" and "next" navigation buttons do not take you to the previous or next record. All of the other buttons on the form work though - you can go to the first, or the last record, and you can search for a new asset.This is the code for the search:
Code:
Private Sub cmdAssetSearch_Click() Dim rs As Object If IsNull(Me.TextAsset) Or Me.TextAsset = "" Then MsgBox "Please type in an asset number to search for.", vbOKOnly Me.TextAsset.SetFocus
[code]....
I've also attached a picture of what I mean when I say there are more asset numbers than what the window shows.
I have a search form that uses a query to show results of a search, but everytime I press search everything comes up even though I have entered search parameters, even though my search requeries every time and the search used to work before I added new records today. Also when I press the query alone on the navigation pane it asks me for the parameters and then it actually works but it won't when I use my form.
please can someone help me with a vb code to view search results in a subform such that double clicking search result on subform displays another form with details of the result. Heeeeeeelp. Thanks
I created a search form (using code from here) that searches serveral fields and displays the results in a listbox. I also created a clear button to clear the fields, including the listbox. I can search all day and it works fine, and the CLEAR button clears out the fields fine but once I have clicked the CLEAR button, I cannot search anymore. I don't get any results anymore (until I close and reopen). It must be something simple that I am overlooking so any hints would be appreciated. Here is my code (sorry it's long!):
Private Sub cmdClearForm_Click() On Error GoTo Err_cmdClearForm_Click
Dim I As Integer
' Cycle through the form's controls, testing for text, ' and clear each field. For I = 0 To Me.Count - 1 If TypeOf Me(I) Is TextBox Then Me(I) = "" ElseIf TypeOf Me(I) Is ListBox Then Me(I).RowSource = " " End If Next
End Sub Private Sub cmdSearch_Click() On Error GoTo Err_cmdSearch_Click
Dim strSQL As String, strOrder As String, strWhere As String, strOrderChoice As String Dim db As DAO.Database 'Dim qryDef As QueryDef Set db = CurrentDb()
If Not IsNull(Me.txtMacAddr1) Then strWhere = strWhere & "(tblAsset.MacAddr1) like '*" & Me.txtMacAddr1 & "*' and " strOrderChoice = "tblAsset.MacAddr1" End If
If Not IsNull(Me.txtMacAddr1) Then strWhere = strWhere & "(tblAsset.MacAddr2) like '*" & Me.txtMacAddr1 & "*' and " strOrderChoice = "tblAssest.MacAddr2" End If
If Not IsNull(Me.txtSerialNum) Then strWhere = strWhere & "(tblAsset.SerialNum) like '*" & Me.txtSerialNum & "*' and " strOrderChoice = "tblAsset.SerialNum" End If
If Not IsNull(Me.txtIPAddress) Then strWhere = strWhere & "(tblIPAddresses.IPAddress) like '*" & Me.txtIPAddress & "*' and " strOrderChoice = "tblIPAddresses.IPAddress" End If
If Not IsNull(Me.txtHostName) Then strWhere = strWhere & "(tblIPAddresses.HostName) like '*" & Me.txtHostName & "*' and " strOrderChoice = "tblIPAddresses.HostName" End If
If Not IsNull(Me.txtJackNumber) Then strWhere = strWhere & "(tblLocation.JackNumber) like '*" & Me.txtJackNumber & "*' and " strOrderChoice = "tblLocation.JackNumber" End If
If Not IsNull(Me.txtCircuitID) Then strWhere = strWhere & "(tblLocation.CircuitID) like '*" & Me.txtCircuitID & "*' and " strOrderChoice = "tblLocaton.CircuitID" End If
If Not IsNull(Me.txtBuilding) Then strWhere = strWhere & "(tblLocation.Building) like '*" & Me.txtBuilding & "*' and " strOrderChoice = "tblLocation.Building" End If
I made a form that lets users search for records in a database and displays them in another form. In that form I've made 3 buttons to let users narrow down the results to show only certain items within the search results.
Now, 2 of the buttons show specific items and the third one toggles the form to display all the records. So lets say I'm filtering records by whether or not they contain the words "car" and "truck." If a record has "car" but not truck and I click the button to sort by "truck" then the search result goes blank, which is ok. But if I click "car" or "show all" to display everything again then the search result stays blank.
This doesn't happen with records that contain both "car" and "truck."
For every button I have something like this: DoCmd.OpenForm "AdminSearchResults", , "SOW", "VendName = '" & VendName & "'", , , "'VendName'"
I know my explanation may suck, but if anyone can help me, that would be great, lol
Using Access 2000 is it possible to specify a starting location ie (c:) and using VBA search every sub folder from this point for files ending .mdb or .xls?
I want to be able to build a table with an record showing the file name and directory for each file found.
Item: Access app front end for an SQL database (production tracking/job logging utility)
Problem: The app has a main search page that allows job entries to be located and opened by varies criteria (job#, job name, etc). I can currently run multiple searches on different criteria successfully but if I open a job window(which has been returned as result of my search) and then close that job window to do a new search my search function will no longer return any results(other then “Calculating….”) unless I close out the access app and reload.
Thanks in advance for any ideas that can point me in the right direction to hunt down my bug.
I did a search and i found a thread that seemed like it would answer my question but for some reason the attachment isnt working. :(
Okay heres the question..
I have a form and it contains 3 fields and 3 command buttons. When i hit the command button it uses a query to display the results. What i want to do is instead of having the results display in a new window, i would like it to display on the same form .. maybe on the bottom of it. Should i use a subform or listbox/combobox..
***Updated*** Search/Email Results has been solved....Working out some bugs and trying to add a Print Address Labels option to the search. The post at Date Nov. 5, 11:4x is the new post with updated info. Thanks! ***Updated***
I have read a ton in the last hour or so on this subject and gained a little insite, but since I have no Access programing experience I am still pretty lost. However, I have programing experience in other areas, so if it requires some macros, I shouldn't have too much trouble. /crossfingers
I have put together a database for the business I work for that contains around 3,000 contacts. I am trying to figure out a way to do a search that will search out specific contacts and email them a newsletter. Their email address is included in their contact information. So I assume I need a way to search for a specific criteria, grab their email address, and then email them with either an attached document, a prior written email, or have included the newsletter in the body of the code to add into the created email.
When you put a combo box to search the values in a form what happens if there are more than one (in my case) name that matches the criteria. ie: if you search for Smith and there are 10 people with the surname of Smith it brings up the first record. is there a way of doing adding a "search again' function so you can look for another Smith?
I have successfully created a dynamic search form, which filters a listbox as the user is typing into a textbox.However, I am now trying to make the search more basic, which I cannot do. I want the listbox to be blank, and only display results where the number in the textbox matches one of the fields in the listbox.
Code:
Sub SearchFor() 'Create a string (text) variable Dim vSearchString As String 'Populate the string variable with the text entered in the Text Box SearchFor vSearchString = SearchForProp.Text
Hi, I'm just wondering if it's possible to display the result of a query on a subform which does not have a relationship with any other table.
What I'm doing is creating a search form where a query is built from the users input (through combo boxes and text boxes) of what table, attribute and condition they want to search from. When they press the search button, I want the result to be displayed in a datasheet below the selection criteria
The first thing I thought of using to display information with was a subform, but I think the purpose of having the subform is so that it can be linked with a form. So, is there another control or way of displaying results. The results can come from any table.
I am running Access 2013. I have created a search form with about 10 different categories from a single table. I will only show 5 fields for this example The form is called FrmSearch with
Description CarNum SerialNum Category Condition
In the query, I have the criteria, Like "*" & [Forms]![FrmSearch]![description] & "*" and have this same criteria for all fields with the proper text field entry. (CarNum, serialnum, category, etc)
The problem I have is that I have over 200 items listed in the Description column but only 2 entries in the CarNum column. When I run the search with nothing in the FrmSearch, it should show all data but it only shows the 2 CarNum. If I put something in the Description, only the two items that show CarNum. I tried to use Is Null and Is Not Null but still doesn't work. I take out the "Like" criteria from the CarNum and it works. So, it seems that it does not pull up all the records because the CarNum has empty fields.
I have 3 text fields on a form that I search by. I have the search query action set on a button, which produces the results in a datasheet view. Is there any way that I can make the records in the datasheet view clickable so I can select the record and go to the form to update the data?
I just wanted to export the search results into excel files. I have googled about it and I found the VBA code for exporting, which didn't worked out for me.
I used Macros by referencing one of the tutorial and it looks fine. Does the usage of macros for exporting the data into excel is also the correct procedure?
I just wanted to know that am I on the right track?
How to create a search BUTTON to give results on the listbox after a user typing the desired keywords to search.
As of now, the database has "On Change" property that whenever a key is pressed (from time to time; letter per letter) it automatically change. What I want is for the user to finish the word he/she wanted to search then theres a Search BUTTON to press in order to show the results.
Attached is the database...
And also, how to put Reset BUTTON - to reset the search box and ready for the user to type again.
I'm getting a Run-time error 2295: Unknown Message Recepients.
I've got a DB of about 2000 clients. In testing I did a test DB with 50 random clients. Using any search criteria, it would grab those clients and open a new email with their email addresses no problem. However when I do this same thing with my complete DB of 2000 clients, I get this run time error. I'm pretty confused here, and anxious. It looks like the program is working, I just need it to run with all my clients. This is the last thing I must conquer to be finished with this project.
Ok here is what was going on. I have an option group, I would select an option, type in my search criteria into a text box, and click an event button. The program would then search my database for that criteria and grab the emails of the individuals meeting that criteria. A message box would then pop up, listed all the emails it had grabbed I would click ok (my sendobject command is set to edit the email) and at this point instead of opening the email to edit the program would crash.
After scratching my head for several days I moved on and have come back to this problem again two weeks later, and within 15min I realized what was wrong. I guess it is good to walk away and come back fresh sometimes.
What is happening is that the program does not account for entries in my database that do NOT have an email.
Example, let us say we want to search a state...lets use the state of GA for example. If I have 5 entries from GA with email addresses and one entry from GA without an email address, it will crash the program.
My only guess is that the way the program is setup is that it is grabing whatever data is in the email location. It that location is blank, its grabing blank and crashing the program.
I need a way to discard the entries it searches that don't have email addresses or something...
Please help, this is the last item for this project.
Here is the current code:
Code:'Code by M. Walts'Important information! this code requires a reference to the Microsoft DAO object libraryOption Compare DatabaseOption ExplicitPrivate Sub cmdEmail_Click()'will hold the dynamic SQL queryDim strSQL As String'will hold the WHERE clause portion of our SQL queryDim strWHERE As String'will hold all the recipients of this messageDim strRecipients As String'the recordset we will use to get the emails of the records that match our criteriaDim rst As DAO.Recordset'if there is input in the search criteria, then we will run the query and send the e-mailIf txtSearch <> "" Then'if you have more buttons, just add mosr cases (the value of the radio button'= the Case number, so Value of the State radio button is 1, etc.)Select Case opgSearch.ValueCase 1strWHERE = "WHERE State = '" & txtSearch & "'"Case 2strWHERE = "WHERE PrayerSupport = '" & txtSearch & "'"Case 3strWHERE = "WHERE Denom = '" & txtSearch & "'"Case 4strWHERE = "WHERE PACTTrainer = '" & txtSearch & "'"Case 5strWHERE = "WHERE PACTPartner = '" & txtSearch & "'"Case 6strWHERE = "WHERE City = '" & txtSearch & "'"Case 7strWHERE = "WHERE Donor = '" & txtSearch & "'"Case 8strWHERE = "WHERE MailingList = '" & txtSearch & "'"Case 9strWHERE = "WHERE Conference = '" & txtSearch & "'" Case 10strWHERE = "WHERE YouthPastor = '" & txtSearch & "'"Case 11strWHERE = "WHERE PreviousCustomer = '" & txtSearch & "'"End SelectstrSQL = "SELECT EMail FROM tblUser " & strWHERE'run the query and get the results into the recordsetSet rst = CurrentDb.OpenRecordset(strSQL)'Loop through the recordset and add all the EMailsDo While Not rst.EOFstrRecipients = strRecipients & ";" & rst!EMailrst.MoveNextLoop'remove the first ; from the strRecipientsstrRecipients = Right(strRecipients, Len(strRecipients) - 1)MsgBox strRecipientsDoCmd.SendObject , , , , , strRecipients, "Email Subject", "Email Body", Truerst.CloseSet rst = NothingEnd IfEnd Sub'stops a ' entered in the field from breaking the queryPrivate Function SQLSafe(safeMe As String) As StringSQLSafe = Replace(safeMe, "'", "''")End Function
I'm trying to make a search form that makes use of queries that search a table based on what fields I have. How would I go about having the query display all the fields for the record(s) that match the search criteria? This is for Access 2010.
As far as the query is set up, I have several fields with a search criteria, and the others are for displaying the relevant information about the results (since they're not search criteria, I used "Like '*'"). When I ran the query, it doesn't come up with anything - even if the record actually exists in the table with specified criteria.
I have a switchboard which runs a google style search query to find people based on their first name, surname, date of birth or NI number on clicking the search button. It uses the following criteria in the query Like "*" & [Forms]![SearchF]![Firstname] & "*" for each of the above fields.
This works perfectly until someone inputs a record that doesn't have anything in one of the fields. ie, full name and DoB, but no NI number. When a record is entered in this way, the table stores the record but the search query cannot find it.
I want to enter text boxes on a form that are linked to certain fields on a table and when search criteria is typed in show the results in a table on a subform.