473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Search for phone Nos

18
Hi,

I encountered a problem and wondering if anyone can help. I have clients and their phone nos stored, I used The data Type: Text and InputMask as "phone: (123) 123-4567 " but when I conduct a search to find a client by the phone No, Access is not able to find record, although I click the " Match any part of field". when I type the phone No with all the brackets and dash it find it. It is very time consuming for the operator to type the phone No with all the brackets, Is there a way to just type in the No. as in "1231234567" and have access find the record?? I don't care about the brackets, only if I can store the format in a way that will distinguis the area code, Can I add something in the format??
Thanks for any help.
Nov 16 '08 #1
8 2154
ADezii
8,834 Expert 8TB
The 2nd Section of the Input Mask specifies whether Microsoft Access stores the literal display characters in the table when you enter data [( ) and - in the case of Phone Numbers]. If you use 0 for this section, all literal display characters (for example, the parentheses in a phone number input mask) are stored with the value; if you enter 1 or leave this section blank, only characters typed into the control are stored. Try this for your Input Mask, then search for characters only as in :2156478893:
Expand|Select|Wrap|Line Numbers
  1. !\(999") "000\-0000;1;_
Nov 16 '08 #2
Nour469
18
Wow, Thanks! It did work.
I have one more question though, in order for this to work.. I have to click "match any part of field" AND unclick "search fields as formatted" which is how search button opens up the box. Is there a way that when I click "search" it automatically saves my search preferences even after I close Access.

Thanks
Nour
Nov 16 '08 #3
ADezii
8,834 Expert 8TB
Wow, Thanks! It did work.
I have one more question though, in order for this to work.. I have to click "match any part of field" AND unclick "search fields as formatted" which is how search button opens up the box. Is there a way that when I click "search" it automatically saves my search preferences even after I close Access.

Thanks
Nour
Everything that you are describing can be done programmatically. I'll post some sample code for your convenience:
Expand|Select|Wrap|Line Numbers
  1. 'txtFindPhoneNum - Create Text Box on Form, this is your Field
  2.                    'to Search on
  3. 'acAnyWhere - Search anywhere in the Number for the value entered in txtFindPhoneNum
  4. 'False - Perform a Search that is Case 'Insensitive'
  5. 'acSearchAll - Search in 'all' directions (Up and Down)
  6. 'False - Search for the Number as it is 'Stored' in the Database and not as Formatted
  7. 'acCurrent - Search the 'Current' Field (will initially set the Focus to
  8. 'True - Start the search at the first Record
  9.  
  10. 'If Phone Number Search Field is Null, get outta Dodge!
  11.  
  12. If IsNull(Me![txtFindPhoneNum]) Then Exit Sub
  13.  
  14. Me![HomePhone].SetFocus     'Set Focus to the Phone# Field
  15. DoCmd.FindRecord Me![txtFindPhoneNum], acAnywhere, False, acSearchAll, False, acCurrent, True
Nov 16 '08 #4
Nour469
18
Hi ADezii,

Thanks for your reply, but I am just a beginner and this is too complicated for me. Now, if you tell me where to put this code I might be able to make it work... and does this mean we can do the same thing in MSWord? because I run into this problems when I am doing search in Word as well.
Thanks a million.
Nour
Nov 16 '08 #5
Nour469
18
I am running into another problem, when I open my form or table and click search button, it is openeing the window with look in: FORM and not the field I chose and the option " search field as formatted" is dissabled.
The search function is one of the most important factors in my database and I though it is simple. put the cursor in the field and click search. without having to click and choose different options in order to perform the search
Whate am I doing wrong?
Thanks
Nour
Nov 16 '08 #6
ADezii
8,834 Expert 8TB
Hi ADezii,

Thanks for your reply, but I am just a beginner and this is too complicated for me. Now, if you tell me where to put this code I might be able to make it work... and does this mean we can do the same thing in MSWord? because I run into this problems when I am doing search in Word as well.
Thanks a million.
Nour
The code would typically go in the Click() Event of a Command Button, and the syntax should also be compatible with Word.
Nov 16 '08 #7
Nour469
18
Unfortunately it is not working... I am creating a text box, although my nos are already stored in a field in my table. I did enter the codes in the event/onclick section. still getting all kinds of error messages, I changed the name of the "home phone" to "PhoneNo" and when I click search, the Look in: is dissable, the search fields as formatted is dissabled and gives me an error message: The control 'find' the macro is attempting to search cannot be searched. Try on of the following
* add a GoToControl action before the FindRecord action
* for the FindRecord action change the only current firld argument from yes to No
* change the focus to a searchable control.

I have to add that I use the search button not only to search the phoneNo field but also to search the name field or a license no field depending on the what the client has available. I put the cursor in that field and click search.

I am kind of lost!
Nour
Nov 17 '08 #8
ADezii
8,834 Expert 8TB
the Look in: is dissable, the search fields as formatted is dissabled
This can happen when the Field that has the Focus immediately before the Find Operation is launched is a Command Button or similar Object, make sure it is a Text Box.
Nov 17 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: William Morris | last post by:
Apologies in advance for the cross-post. Not sure if this is better handled in ASP code or TransactSQL. Windows2000 Server SQL 2000 tblPeople contactid int firstname varchar(25) lastname...
1
by: Marc Pichouron | last post by:
Hello, so first of all i would say you that i'm french so sorry for my sitakes. I made an application in XML/XSL which presents the people of my company Let me show the structure of my form : ...
1
by: damjanu | last post by:
Dear All; I have 3 issues 1) On some of my tables I have unique indexes, so that for example no two phone numbers can be the same. When user enters phone number that already exists, a scary...
3
by: Jan Szymczuk | last post by:
I am trying to create a query that will show me who is phoning who in an organisation from available Telephone Billing information. I am creating a MSAccess 2000 database with a few few tables, two...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
10
by: Fred | last post by:
OK, I can now successfully enter data into my MySQL database through my CGI web page. I can click a button and retrieve all the records, but I can not seem to get the search code to work. ...
13
by: jfarthing | last post by:
Hi everyone! I am using the script below to search a db. If the is more than one match in the db, all goes well. But if there is only one match in the db, nothing gets displayed. Any...
2
by: ghjk | last post by:
In my web application there is a table user can see the data(id,date phone number etc.). But i want to add add search facility there(Search by ID/phone no). My code is not working and saying "Could...
12
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.