Extracting people from a list

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dixie

    Extracting people from a list

    I have a text box on a form. In that text box is a list of people separated
    by a comma. Like A.Smith, L.Jones, P.Somebody, H. Somebodyelse Note, there
    is no full stop at the end of the list which is all on one horizontal line.

    I need to be able to extract each person in that list and set a field true
    for them.

    If the textbox is called txtPeople and the field I wish to set = -1 is
    called fldTag, is there some simple code I can run from an event to do this?

    TIA
    dixie


  • Jim Evans

    #2
    Re: Extracting people from a list

    Look at the Split() Function in the VB Editor Help. This will give you the
    people in the list, with which to work.

    Jim Evans

    "dixie" <dixie@dogmail. com> wrote in message
    news:421551df$1 @duster.adelaid e.on.net...[color=blue]
    > I have a text box on a form. In that text box is a list of people[/color]
    separated[color=blue]
    > by a comma. Like A.Smith, L.Jones, P.Somebody, H. Somebodyelse Note,[/color]
    there[color=blue]
    > is no full stop at the end of the list which is all on one horizontal[/color]
    line.[color=blue]
    >
    > I need to be able to extract each person in that list and set a field true
    > for them.
    >
    > If the textbox is called txtPeople and the field I wish to set = -1 is
    > called fldTag, is there some simple code I can run from an event to do[/color]
    this?[color=blue]
    >
    > TIA
    > dixie
    >
    >[/color]


    Comment

    • Albert D. Kallal

      #3
      Re: Extracting people from a list

      You don't really mention what you want to do with the names.

      You could place a buttion on your form, and when clicked, it would show each
      name. The code would look like:



      Dim vList As Variant
      Dim i As Integer

      vList = Split(me!txtPeo ple, ",")

      For i = 0 To UBound(vList)

      Debug.Print vList(i)

      Next i

      End Sub

      The above would extract all names one by one from the txtbox. It is not
      clear how/when you want to set the fldTag field? Do you have more then one
      fldTag?


      --
      Albert D. Kallal (Access MVP)
      Edmonton, Alberta Canada
      pleaseNOOSpamKa llal@msn.com



      Comment

      • dixie

        #4
        Re: Extracting people from a list

        It is a list of supervisors accompanying a group. Say I wish to edit the
        list and add one more supervisor. All supervisors names for the entry are
        stored in a single field and they were added to that field basically by
        setting a True/False field (fldTag) to true and having each one of them
        appended to the list with a comma-space delimiting them.. After they are in
        the collective field, the true false tag is reset to false. Now, if I wish
        to later add a supervisor to the existing list, I click their name in a
        combo box, their tag is set and they replace the multiple names already in
        the field. What I was aiming to do was at the same time as selecting the
        new supervisor, have the names in the list in the text box also have their
        tag set to true. This should ensure all the supervisors, including the
        existing ones and the new one(s) will be placed in the List field. So,
        answering your questions, the fldTag field should be set for all people in
        the list as an after update event from clicking the new person in a
        supervisor combo box, and there is only one fldTag.

        I'm afraid explaining things is not my forte. Does that make sense?

        dixie

        "Albert D. Kallal" <kallal@msn.com > wrote in message
        news:T2kRd.4206 83$8l.348553@pd 7tw1no...[color=blue]
        > You don't really mention what you want to do with the names.
        >
        > You could place a buttion on your form, and when clicked, it would show
        > each name. The code would look like:
        >
        >
        >
        > Dim vList As Variant
        > Dim i As Integer
        >
        > vList = Split(me!txtPeo ple, ",")
        >
        > For i = 0 To UBound(vList)
        >
        > Debug.Print vList(i)
        >
        > Next i
        >
        > End Sub
        >
        > The above would extract all names one by one from the txtbox. It is not
        > clear how/when you want to set the fldTag field? Do you have more then one
        > fldTag?
        >
        >
        > --
        > Albert D. Kallal (Access MVP)
        > Edmonton, Alberta Canada
        > pleaseNOOSpamKa llal@msn.com
        > http://www.members.shaw.ca/AlbertKallal
        >[/color]


        Comment

        • dixie

          #5
          Re: Extracting people from a list

          OK, I am at the stage where I can click a button and get a list of the
          supervisors in the immediate window, but what I want to do with this Split
          is simply to set a boolean field for each one to true. I can't seem to make
          the connection between getting a list of names in the immediate window and
          doing this?

          dixie

          "dixie" <dixie@dogmail. com> wrote in message
          news:42165475$1 @duster.adelaid e.on.net...[color=blue]
          > It is a list of supervisors accompanying a group. Say I wish to edit the
          > list and add one more supervisor. All supervisors names for the entry are
          > stored in a single field and they were added to that field basically by
          > setting a True/False field (fldTag) to true and having each one of them
          > appended to the list with a comma-space delimiting them.. After they are
          > in the collective field, the true false tag is reset to false. Now, if I
          > wish to later add a supervisor to the existing list, I click their name in
          > a combo box, their tag is set and they replace the multiple names already
          > in the field. What I was aiming to do was at the same time as selecting
          > the new supervisor, have the names in the list in the text box also have
          > their tag set to true. This should ensure all the supervisors, including
          > the existing ones and the new one(s) will be placed in the List field.
          > So, answering your questions, the fldTag field should be set for all
          > people in the list as an after update event from clicking the new person
          > in a supervisor combo box, and there is only one fldTag.
          >
          > I'm afraid explaining things is not my forte. Does that make sense?
          >
          > dixie
          >
          > "Albert D. Kallal" <kallal@msn.com > wrote in message
          > news:T2kRd.4206 83$8l.348553@pd 7tw1no...[color=green]
          >> You don't really mention what you want to do with the names.
          >>
          >> You could place a buttion on your form, and when clicked, it would show
          >> each name. The code would look like:
          >>
          >>
          >>
          >> Dim vList As Variant
          >> Dim i As Integer
          >>
          >> vList = Split(me!txtPeo ple, ",")
          >>
          >> For i = 0 To UBound(vList)
          >>
          >> Debug.Print vList(i)
          >>
          >> Next i
          >>
          >> End Sub
          >>
          >> The above would extract all names one by one from the txtbox. It is not
          >> clear how/when you want to set the fldTag field? Do you have more then
          >> one fldTag?
          >>
          >>
          >> --
          >> Albert D. Kallal (Access MVP)
          >> Edmonton, Alberta Canada
          >> pleaseNOOSpamKa llal@msn.com
          >> http://www.members.shaw.ca/AlbertKallal
          >>[/color]
          >
          >[/color]


          Comment

          • dixie

            #6
            Re: Extracting people from a list

            OK, I am at the stage where I can click a button and get a list of the
            supervisors in the immediate window, but what I want to do with this Split
            is simply to set a boolean field for each one to true. I can't seem to make
            the connection between getting a list of names in the immediate window and
            doing this?

            dixie

            "dixie" <dixie@dogmail. com> wrote in message
            news:42165475$1 @duster.adelaid e.on.net...[color=blue]
            > It is a list of supervisors accompanying a group. Say I wish to edit the
            > list and add one more supervisor. All supervisors names for the entry are
            > stored in a single field and they were added to that field basically by
            > setting a True/False field (fldTag) to true and having each one of them
            > appended to the list with a comma-space delimiting them.. After they are
            > in the collective field, the true false tag is reset to false. Now, if I
            > wish to later add a supervisor to the existing list, I click their name in
            > a combo box, their tag is set and they replace the multiple names already
            > in the field. What I was aiming to do was at the same time as selecting
            > the new supervisor, have the names in the list in the text box also have
            > their tag set to true. This should ensure all the supervisors, including
            > the existing ones and the new one(s) will be placed in the List field.
            > So, answering your questions, the fldTag field should be set for all
            > people in the list as an after update event from clicking the new person
            > in a supervisor combo box, and there is only one fldTag.
            >
            > I'm afraid explaining things is not my forte. Does that make sense?
            >
            > dixie
            >
            > "Albert D. Kallal" <kallal@msn.com > wrote in message
            > news:T2kRd.4206 83$8l.348553@pd 7tw1no...[color=green]
            >> You don't really mention what you want to do with the names.
            >>
            >> You could place a buttion on your form, and when clicked, it would show
            >> each name. The code would look like:
            >>
            >>
            >>
            >> Dim vList As Variant
            >> Dim i As Integer
            >>
            >> vList = Split(me!txtPeo ple, ",")
            >>
            >> For i = 0 To UBound(vList)
            >>
            >> Debug.Print vList(i)
            >>
            >> Next i
            >>
            >> End Sub
            >>
            >> The above would extract all names one by one from the txtbox. It is not
            >> clear how/when you want to set the fldTag field? Do you have more then
            >> one fldTag?
            >>
            >>
            >> --
            >> Albert D. Kallal (Access MVP)
            >> Edmonton, Alberta Canada
            >> pleaseNOOSpamKa llal@msn.com
            >> http://www.members.shaw.ca/AlbertKallal
            >>[/color]
            >
            >[/color]


            Comment

            • jimfortune@compumarc.com

              #7
              Re: Extracting people from a list

              dixie wrote:[color=blue]
              > OK, I am at the stage where I can click a button and get a list of[/color]
              the[color=blue]
              > supervisors in the immediate window, but what I want to do with this[/color]
              Split[color=blue]
              > is simply to set a boolean field for each one to true. I can't seem[/color]
              to make[color=blue]
              > the connection between getting a list of names in the immediate[/color]
              window and[color=blue]
              > doing this?
              >
              > dixie[/color]

              Hi Dixie,

              Here are some key words that may prove useful: RecordsetClone (before
              loop), FindFirst, NoMatch, Edit, Update, Refresh (after loop). I think
              Albert just used Debug.Print to show you that the names are available
              in vList(i). I would also consider the possibility of using a separate
              table to hold the list of supervisors accompanying the groups. It
              might be simpler to implement, or not.

              James A. Fortune

              Chumps can sit ... We'll stand up.
              -- Malcolm X

              Comment

              • jimfortune@compumarc.com

                #8
                Re: Extracting people from a list

                dixie wrote:[color=blue]
                > OK, I am at the stage where I can click a button and get a list of[/color]
                the[color=blue]
                > supervisors in the immediate window, but what I want to do with this[/color]
                Split[color=blue]
                > is simply to set a boolean field for each one to true. I can't seem[/color]
                to make[color=blue]
                > the connection between getting a list of names in the immediate[/color]
                window and[color=blue]
                > doing this?
                >
                > dixie[/color]

                Hi Dixie,

                Here are some key words that may prove useful: RecordsetClone (before
                loop), FindFirst, NoMatch, Edit, Update, Refresh (after loop). I think
                Albert just used Debug.Print to show you that the names are available
                in vList(i). I would also consider the possibility of using a separate
                table to hold the list of supervisors accompanying the groups. It
                might be simpler to implement, or not.

                James A. Fortune

                Chumps can sit ... We'll stand up.
                -- Malcolm X

                Comment

                Working...