Results 1 to 3 of 3
  1. #1
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80

    Replacement in table with VB code

    Hi,
    friend I have table with too fields
    the first field with phone number is text and the send price with number
    as below
    number price


    9312348
    9334568
    9357898
    4483578
    4456789

    I want code find first 93* but not like 933 and 935
    replace price with 1.2
    and replace 933* with price 2.1
    and replace 935* replace with 2.2

    I have make code to replace

    Plz show how to open table and with full code
    I want to make form when I click on it do this

    thx

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Quote Originally Posted by miziri View Post
    Hi,
    friend I have table with too fields
    the first field with phone number is text and the send price with number
    as below
    number price
    9312348
    9334568
    9357898
    4483578
    4456789

    I want code find first 93* but not like 933 and 935
    replace price with 1.2
    and replace 933* with price 2.1
    and replace 935* replace with 2.2

    I have make code to replace

    Plz show how to open table and with full code
    I want to make form when I click on it do this

    thx
    I have used this expression in a query.

    Convert: IIf(Not Left([fff],3)="933" And Not Left([fff],3)="935" And Left([fff],2)="93",1.2,IIf(Left([fff],3)="933",2.1,IIf(Left([fff],3)="935",2.2)))

    I think it will give you the result you want

    attached is a snapshot of the end result of the query

  3. #3
    miziri is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    80

    Thanks for answer

    Hi,
    friend my thx
    problem as u know this country code phone number
    like india with many phone company each one has differnt rate.
    now I have about 425 code,
    is there was to do for all or i need to enter like ur above.

    see below
    i have 425 do i need
    PROTEL RatesIDDestinationCode rate 2Afghanistan93xxx
    3Afghanistan-Mobile9375xx
    4Afghanistan-Mobile Awcc9370xx
    5Afghanistan-Mobile Etisalat9378xx
    6Afghanistan-Mobile MTN9377xxx
    7Afghanistan-Mobile Roshan9379xxx
    8Angola244xxx
    9Angola-Mobile2449xxx
    10Angola-Mobile Movicel24491xx
    11Angola-Mobile Unitel24492xx
    12Angola-Mobile Unitel24493xxx
    13Bahrain973xxx
    14Bahrain-Mena Telecom Wimax97377xxx
    15Bahrain-Mobile9733xxx
    16Bahrain-Mobile9739xx
    17Bahrain-Mobile Batelco973383x
    18Bahrain-Mobile Batelco973388xx
    19Bahrain-Mobile Batelco97339xx
    20Bahrain-Mobile-MTC97336xx


    thx

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA code - questions table onto forms
    By Tman in forum Programming
    Replies: 3
    Last Post: 04-26-2010, 05:47 AM
  2. How to loop code to run through entire table
    By kmajors in forum Reports
    Replies: 9
    Last Post: 04-23-2010, 09:27 AM
  3. Replies: 3
    Last Post: 04-14-2010, 10:07 AM
  4. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  5. Replies: 2
    Last Post: 10-27-2009, 07:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums