Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2020
    Posts
    5

    Question Pull email string from a column, and isolate email domain in another column in a Query

    Hi



    I'm building a query - and currently, the source is from one table one. In the query I have a lot of emailaddresses, and I want to add a column where I extract the string AFTER the @-sign, and that string I want to use on my custom column.

    In Excel that's easy (sort of), I used formulas (e.g. =RIGHT(B2;LEN(B2)-FIND("@";B2))). Is that possible in a Query? I prefer the query, because, I will need to replace the table multiple times in the near future.

    I would appreciate if the solution could be a little detailed, on how to build the query, e.g. do I work within SQL view, or Query builder.

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    SQLView or query builder.

    https://support.microsoft.com/en-us/...__toc355966595

    An expression would be like:

    Mid(fieldname, InStr(fieldname, "@") + 1)

    https://support.microsoft.com/en-us/...5-2eb4a099ec72
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Nov 2020
    Posts
    5
    Thanks (so far), how would that look "in SQL"? Here's the SQL view in MS Access:

    SELECT tblWorkday.[Legal First Name], tblWorkday.[Legal Last Name], tblWorkday.[Email - Work], tblWorkday.[UPN]
    FROM tblWorkday;

  4. #4
    Join Date
    Nov 2020
    Posts
    5
    Instead of putting it in a query, I tried to add a calculated column at the end of the source table using the somewhat different expression ( I believe I have to use semi-commas, instead of commas, due to regional setting (I live in Denmark)) - here's the expressions:
    Mid(UPN, InStr(UPN, "@") + 1) -> Error msg.: THE EXPRESSION YOU HAVE ENTERED HAS AN INVALID . (DOT) OR ! OPERATOR OR INVALID PARENTHESIS (You may have entered an invalid identifier or typed paranthesis following the NULL constant)
    Mid(UPN; InStr(UPN; "@") + 1) -> Error msg: SYNTAX ERROR IN EXPRESSION

    Any help is appreciated


  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    I gave you a link that shows how to build expression in query. What about it did you not understand?

    Okay, this is new to me. InStr() function in table calculated field requires all 3 arguments have parameter.

    Mid(UPN; InStr(1; UPN; "@") + 1)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Join Date
    Nov 2020
    Posts
    5
    Thanks a lot - apart from the semi-colons (I had to use commas), it works like this:

    SELECT (Mid(UPN, InStr(1, UPN, "@") + 1))
    FROM tblWorkday;

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

Similar Threads

  1. Replies: 5
    Last Post: 05-07-2014, 09:25 AM
  2. Replies: 1
    Last Post: 11-10-2012, 09:13 AM
  3. create comma delimited string from column in query
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 04-30-2011, 04:26 PM
  4. Replies: 3
    Last Post: 04-19-2011, 06:41 PM
  5. Isolate Column in Combo Box
    By jgelpi16 in forum Forms
    Replies: 2
    Last Post: 05-06-2010, 12:52 PM

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