Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Quote Originally Posted by Micron View Post
    So the approach might be to start from the right and in a loop For i = 1 To Len(str) where str is the value being examined, increment counter n looking for 8 successive integers. If not successful at any point, start n at 0 again and continue. When 8 are found, go left 1 more character and extract a total of 9 IF that character is alpha. ??
    If 9th isn't alpha then carry on until 1 alpha is found and extract 9 from there??



    EDIT: if that is accurate, you should post a db with a table of test data. It should contain a field for storing the derived value as well.
    I don't mind helping out with complex problems, but I believe it's incumbent upon the poster to do some of the work.

    I always enjoy your input. Keep on jumping in
    I do believe that should work! I am compiling sample data now and will upload very soon.

  2. #17
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Test Database.zip

    Attached is a sample DB that has a table with two columns (RECORD_KEY and ACC_NO). I prefilled the ACC_NO field so that you could see what the expected result should look like. Any help with this would be extremely helpful.

  3. #18
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Here is my attempt..... (Micron will probably have a better way )

    I renamed "Acc_NO" to "Acc_Num"... I dislike seeing "NO" in a name when it means "Num".
    There were a couple of references that were missing (I have A2010), so I had to fix that........
    But see if this is close to what you are looking for.



    From here (if it meets your needs), the code could be converted to a function so it could be used in a query. Of course, in a query, you would not need/want the update section.


    (Edit: dB removed due to technical issues. (OP broke it)

  4. #19
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Yes, thank you!! This is exactly what I need. Thank you both very much! This looks to be along the lines of what Micron was suggesting.

  5. #20
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    I tested the code you provided a little further and found a slight issue. I am not sure why it is happening though. I typed "efegergwrg757" into the RECORD_KEY field and the ACC_NUM field populated with "ergwrg757". Any ideas on how to prevent it from returning false data?

  6. #21
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Hmmm. At first I thought I was beaten to the punch. Maybe quicker to fix the solution's "problem" rather than me continue. I have it working for anything up to this length at least
    01Z36294756B87654321
    plus I was updating the table on the fly rather than relying on a query. Will have to see how much better ssanfu's is but am signing off for the night. Almost 1 AM

  7. #22
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Now why did you have to go and break it???
    It was working soooo well!

    But is was a good catch...

    Try and break it again... go ahead - just try!



    (9 pm here - but I'm tired)
    Attached Files Attached Files

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 04-04-2018, 10:36 AM
  2. Extract specific text from very long string
    By csmith in forum Queries
    Replies: 24
    Last Post: 03-03-2017, 09:25 AM
  3. Replies: 7
    Last Post: 02-29-2016, 06:13 PM
  4. Replies: 2
    Last Post: 10-21-2015, 12:00 PM
  5. Extract Specific Data from Access
    By iamstupid in forum Access
    Replies: 1
    Last Post: 05-26-2011, 12:58 AM

Tags for this Thread

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