Results 1 to 12 of 12
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Separating VALUES in FIELDS/COLUMNS


    i have a table with two columns, one column is Address and the second column is City. However, the values under those fields are combined with Address and City, separated by a comma. How do I delete everything before the comma in the City field and delete everything after the comma (including the comma) in the Address Field


    currently it looks like this:

    Address City<-----Fields
    1280 One St, San Jose 1280 One St,San Jose, CA<----Values

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    I read your question as desiring an edit which keeps the same table...

    Quote Originally Posted by taimysho0 View Post
    i have a table with two columns, one column is Address and the second column is City. However, the values under those fields are combined with Address and City, separated by a comma. How do I delete everything before the comma in the City field and delete everything after the comma (including the comma) in the Address Field


    currently it looks like this:

    Address City<-----Fields
    1280 One St, San Jose 1280 One St,San Jose, CA<----Values
    and fields, but with the street address separated from the city and state.
    If this is close, start by (creating a copy of your table, then) creating a select query where the existing fields are recalculated using string functions. When you get the select query working, change it to an edit query and rock on.
    It's late in my world, so you can google 'string functions'.

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    hello, im a bit confused i have basic knowledge of vb and access. i googled but still unclear, can you be more specific? thanks!

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    You are on overtime.

    Use the INSTR function to locate the comma and the REPLACE function to wipeout/keep the appropriate part.

  5. #5
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    NewAddr: Left([Addr],InStr([Addr],',')-1)

    NewCity: Mid([City],InStr([City],',')+1,Len([City])-InStr([City],','))

  6. #6
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    aytee111 gave you the particulars of how to separate the pieces.

    Hit us again tomorrow if you still don't have the big picture.

  7. #7
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    im in the design view of the query but where do i insert those functions?

  8. #8
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    nevermind, i got it. i put the functions in the "field" portion of the design view. thanks for the help!

  9. #9
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    actually, i have another question lets say i have a column with different values. if the value is "oen" (due to typos) i want to change this value to "one" only in that column. How would i do this?

  10. #10
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Just a guess...

    In your query, in which the column with errors is ColX:
    ColX:iif([ColX]="oen","one",[ColX])

    I think I got by with that...

  11. #11
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    does that go into "field"? or "criteria"?

  12. #12
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    My suggestion was to be inserted in a query field. However,

    if you don't have many to correct, I'd suggest you just put "oen" in the criteria and manually enter the corrections.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-03-2011, 01:07 AM
  2. Combining values of 2 columns into one string
    By LAazsx in forum Programming
    Replies: 1
    Last Post: 11-25-2010, 08:36 PM
  3. Replies: 1
    Last Post: 10-09-2009, 11:52 AM
  4. Replies: 1
    Last Post: 10-01-2009, 06:41 AM
  5. Setting default values in columns
    By crownedzero in forum Programming
    Replies: 0
    Last Post: 06-17-2009, 06:45 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