Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wildcard Help

Status
Not open for further replies.

MadMax7

MIS
Feb 17, 2004
62
GB
I have a list of customer telephone numbers (field Name "CLINumber")in a table what i need to be able td do is to confirm form the inital std code what area the call should have been deliverd to. so i want to set up a module to check each record for example if the customer number is 01132151239 i need to be able to say in code if CLiNumber = 0113* then manchester. can some one please help with how i would write this into a module

 
telephonenumber = " 01132151239"
clinumber = left(telephonenumber,4)

the problem I see is some numbers are 4 characters and others are 5 in length.

How about splitting the number into two fields?


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
sorry to sound a bit thick but what do you mean by splitting the number down beacause of the issue of some std being 4 5 or even 6 numbers was why i thought about using a wildcard
 
i do have another table that shows me all STD's and there delivery points but i have no way of linking the tables together
 
I mean some STD'd are 4 character like 0161 , 0207, 0208 , etc
but my phone number starts with 01606 (5 characters). Now you see what I mean? If all you phone numbers are only in areas which have 4 std numbers then you could use the method I shown above, but for future compatability you may have to check for 5 characters. (This is all assuming your numbers are stored as string)

Another way would to be to put a space after the std code in the telephone number then you could check for the space and anything before it would be the std code.
take a look at instr() and left() functions.


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
ProgramError thanks for your help i have looked at the Instr() function, would i have to inputt all the STd's for it to look for and thenm put a space or is there be a quicker way to do this?

thanks again
 
How many customers do you have? A few then I'd insert the space manually otherwise try using an update query with the following in the update field.

= left(CLINumber,4) & " " & mid(CLInumber,5)

This will insert a space after the 4th character in the string.
[COLOR=red yellow]DONT FORGET TO SAVE A COPY OF THE DB BEFORE YOU RUN THE QUERY IN CASE THERE ARE PROBLEMS.[/color]

Take a look at the mid()function too.

Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top