Results 1 to 11 of 11
  1. #1
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21

    Query/Update what I selected

    This will be a noob question but I cant find anything online, maybe Im searching the wrong criteria

    So basically I am trying isolate data in a field and updating it to that selection.

    Example, there is a sentence in the field where someone has typed on what a student owes. (Im accessing a student comment table and trying to create a mail merge using data within it.)

    Sentence: Student owes $12.00 and is due by 12/12/14.



    What I want to do, is only isolate the $12.00 and create that in a new field or table or just delete everything before and after it.

    Appreciate any assistance!


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    That will be very difficult if not impossible. Depends on text having a consistent structure. Will there always be a $ sign and only 1?

    The student owe amount should be determined by querying data.
    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
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    Hi June, thanks for the quick response! I can inform the staff to use consistent data entry. I was thinking they can enter the amount like.... Amount12.00 or Dollar12.00.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why is this necessary? Sounds like poor database design. Depending on users to always enter by prescribed pattern is certain to fail. The $ sign would be easy to work with. Whichever pattern you decide on is not important, consistency is.

    Val(Mid([fieldname], InStr([fieldname],"$")+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.

  5. #5
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    Thanks! I will try that out. Wasn't sure the $ would cause an issue. This will help tremendously. Thank you!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Note that the expression will fail if there is nothing in the field. Try this modification:

    Val(Mid(Nz([fieldname],""), InStr(Nz([fieldname],""),"$")+1))

    It will return 0 if the field is Null.
    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.

  7. #7
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    This worked great. I talked to the staff and they forget to mention that there also could be another amount owed for another item.

    Example: Student owes $12.00 and is due by 12/12/14. Also owes $40.00 for misc items.

    So I thought, well maybe we could either use this format $$40.00 or &40.00 for the second item.

    Is there a string similar to Val(Mid(Nz([fieldname],""), InStr(Nz([fieldname],""),"$")+1)) were it is looking at $$ or & instead where I can create another column? Thank you!

  8. #8
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    Nevermind! got it!
    Val(Mid(Nz([fieldname],""), InStr(Nz([fieldname],""),"$")+2))

  9. #9
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    Opps

    Val(Mid(Nz([fieldname],""), InStr(Nz([fieldname],""),"$$")+2))

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What about 3rd or 4th or nth occurrences of monetary info?
    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.

  11. #11
    vtaurusv is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    21
    I hinted to them if that happens they are "SOL" . I told them the should rethink their business practices.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-15-2012, 02:36 PM
  2. Replies: 6
    Last Post: 05-10-2012, 08:20 PM
  3. Replies: 4
    Last Post: 05-08-2012, 10:04 AM
  4. Replies: 3
    Last Post: 01-27-2012, 06:45 PM
  5. Replies: 9
    Last Post: 12-18-2010, 12:51 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