Using a Delimiter on an inventory input text box to create multiple entries RRS feed

  • Question

  • Good morning,

    I am currently working on a project at my work in which i'm trying to make an inventory database on access. They have a scanner that can scan multiple inputs and then transfer those inputs all at one to a location, such as a cell or a textbox. 

    It's fairly easy to make a form that consists of a text box to input individual data, however this one works for one set of data at a time separated by a tab delimiter. I'm wondering what the best way to go about achieving this is? From what i've found split() seems to be promising i'm just not sure how to implement it or if there are other ways. Thank you!!

    Example: Currently - enter 'data1' in textbox and hit save, enter 'data2' in textbox and at same

    I want to get to: - enter 'data 1    data 2     data3' hit save, saves as seperate records, data 1, data 2, data 3.

    Tuesday, April 11, 2017 1:21 PM

All replies

  • You will have to write some VBA along these lines:
    dim s() as string
    dim sElement as string
    s=split(Me.myTextbox, vbTab)
    for each sElement in s
      CurrentDB.Execute "insert into myTable(myField) values('" & sElement & "');", dbFailOnError

    (of course you replace myObjectNames with yours)

    -Tom. Microsoft Access MVP

    • Proposed as answer by Chenchen Li Wednesday, April 12, 2017 5:03 AM
    Tuesday, April 11, 2017 1:56 PM