Results 1 to 4 of 4
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    Calculated Text Field

    Can anyone provide some guidance about the best way to create a calculated field based on a text field. In other words how can I create a field that SUMs records where the text content of another field CONTAINS some text.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    What is the structure of the data? Are the alpha characters always the same length and in the same position? Provide examples.
    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
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    Hi June, it's variable length and format but I want to count where the field always contains "text" for instance.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    You want to Count, not Sum? Try:

    SELECT Count("*") FROM table WHERE [textfield] LIKE "*text*";

    or

    SELECT *, (SELECT Count("*") FROM table WHERE [textfield] LIKE "*text*") AS Cnt FROM table WHERE [textfield] LIKE "*text*";

    or

    SELECT *, DCount("*", "table", "textfield LIKE '*text*'") As Cnt FROM table WHERE [textfield] LIKE "*text*";

    "text" is some input by user. If you want to extract "text" from the value and do aggregate (GROUP BY) count calc, that requires a consistent structure (length, position), otherwise gets very difficult.
    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.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2014, 06:42 AM
  2. Can I make a calculated text field unique?
    By alexandervj in forum Access
    Replies: 3
    Last Post: 03-21-2014, 09:17 AM
  3. Replies: 3
    Last Post: 02-12-2014, 12:18 PM
  4. Replies: 4
    Last Post: 09-02-2013, 03:00 PM
  5. Can Calculated Field (Text) Be Edited?
    By melhzy in forum Access
    Replies: 1
    Last Post: 11-26-2012, 12:12 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