Parse a string in a text box

  • Thread starter Thread starter Rebecca
  • Start date Start date
R

Rebecca

Hello,

I have a list box on a form that a user can select
multiple values from. This list box is populated by a
table. I have also added a text box on the form in case
there is a value that does not currently exist in the list
box (actually it does not exist in the table) that the
user would like to add. I provided guidance to the user
that if they enter multiple values into the text box that
they separate each value with a ";". Now comes the tricky
part...I am unsure how I would go about parsing these
values and storing them into the table. I would like
these values to be added to the table that is linked to a
list box. The table is called tblPlatform. The field in
the table is platform. The text box is platformTxtbx. I
appreciate any assistance that you can offer. Thanks in
advance for your time, have a good day!
 
Dim a As Variant, i As Long
a = Split(me.platformTxtbx, ";")
For i = LBound(a) To UBound(a)
currentdb.execute "insert into Categories (platform) values (" &
a(i) & ")"
Next i
 
Back
Top