Results 1 to 8 of 8
  1. #1
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253

    Splitting data from a QR code into different fields

    This is an example of the data that i get from scanning a QR code. I am trying to figure out if there is a way for access to split out the data as it is scanned or on a button click to split out the data into the respective fields. Also what trouble could i run into with this. I need to prevent bad data transfers.



    EXAMPLE:

    N;1;9999;CD9999R;N;4/29/20;89.0;PASS;300.00;-10.00;3.000;1.00;200.00;-20.00;PASS;PASS;11.0;1;JD

    here is what is in the fields:

    Location of test;Item number;project num;serial num;yes/no;date tested;test reading1;test reading2;test reading3;test reading4;test reading5;test reading6;test reading7;test reading8;test reading9;test reading10;water temperature; number tested that day;test operator initials

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    scan the qc into a text box,
    then some code to parse the string into other text boxes

    Code:
    sub ParseScan()
    Code:
    sLongCode = txtScan
    iFld = 1
    i = instr(sLongCode,";")
    while i > 0
        sWord = left(sLongCode,i-1)  'get next fld in string
        sLongCode = mid(sLongCode,i+1)  'reduce string
    
       select case iFld
         case 1
           txtBox1 = sWord
         case 2
           txtBox2 = sWord
        'etc...
     end select
    
       i = instr(sLongCode,";") 
       iFld = iFld + 1
    wend
    txtBox99 = sWord
    end sub
    

  3. #3
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    ranman, could you give me a little more explanation on how your code works?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    the code would go in a button click
    the QR would scan into a text box : txtScan

    1. scan the code
    2. click the button,
    3. the code breaks up the txtScan into all the other boxes (fields)

  5. #5
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    i understand that part. I was meaning how the insides of while loop part works and what all of the variables mean. Thank you for your help i am trying to understand how the code works so i can apply it to other things in the future.

  6. #6
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    Ranman I figured out all that code but i do have another question for you. If the QR code has another line just like the first one how do i make that another record.

  7. #7
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Ten the code would need to detect vbCrLf in case there are multiple lines.

  8. #8
    NightWalker's Avatar
    NightWalker is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2016
    Location
    Midwest USA
    Posts
    253
    What if it is just a big long line of the sample back to back?

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

Similar Threads

  1. Replies: 3
    Last Post: 12-11-2016, 03:51 PM
  2. Auto Splitting a query using VB code
    By dfaulkner1 in forum Access
    Replies: 3
    Last Post: 07-29-2015, 02:36 AM
  3. Replies: 2
    Last Post: 04-14-2015, 07:21 AM
  4. Splitting Data Using A Scanned Bar-code Entry
    By euphonium01 in forum Forms
    Replies: 4
    Last Post: 03-24-2014, 11:32 AM
  5. splitting data multiple fields
    By rpollard in forum Access
    Replies: 0
    Last Post: 03-22-2011, 07:15 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