If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Search fields in form
I have read through all the posts in this forum, but still need help. My
questions are re. searching a form in my contacts database. F_Contacts = Form which contains all contact particulars (ie. fields CompanyName, PhoneNo1, PhoneNo2) Contacts = table to store info entered in F_Contacts F_Search1 = Form to search for Phone Number F_Search2 = Form to search for Company Name 1. Based on the code below, I managed to successfully search for PhoneNo1. How to extend the search so that it will search for both fields PhoneNo1 and Phone2? How to SetFocus to the field that shows the match? '---------- If Not IsNull(Me.txtSearch) Then strWhere = "[PhoneNo1] = """ & Me.txtSearch & """" DoCmd.OpenForm "F_Contacts", WhereCondition:=strWhere DoCmd.Close acForm, "F_Search1" Forms!F_Contacts!PhoneNo1.SetFocus Else MsgBox "Please enter Phone Number." End If '---------- 2. How do I enhance the code above so that if there is no matches to the specified search criteria, it displays a message "Not found"? 3. I'm planning to create a search button in form F_Contacts with a text box that allows for searching CompanyName. I would like to allow entering of partial search text instead of the whole company name using wildcards (*). I would like to write the code in using a search button but don't know how. Pls help. Thanks a lot in advance |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combo Box NotInList - How To Add Data To Underlying Table | 10SNUT | Using Forms | 19 | July 8th, 2005 09:12 PM |
Copy form data to a table | Gunner | General Discussion | 5 | January 24th, 2005 08:53 PM |
Need to clear controls of Filter form | Jan Il | Using Forms | 2 | November 28th, 2004 02:04 PM |
Dates in a listbox connected to a form... | RusCat | Using Forms | 13 | November 25th, 2004 02:31 AM |
Strange stLinkCriteria behaviour on command button | Anthony Dowd | Using Forms | 3 | August 21st, 2004 03:01 AM |