A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Search fields in form



 
 
Thread Tools Display Modes
  #1  
Old August 25th, 2005, 10:25 AM
spacerocket
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 04:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.