Re: looping thru a fields values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 07/20/04

  • Next message: Roy: "Atribute values by position on Query..."
    Date: Tue, 20 Jul 2004 12:04:05 +0800
    
    

    The simplest way might be to write a piece of code using the Split()
    function to generate an array of FirstNames and an array of LastNames. Loop
    from LBound to UBound, and AddNew to a Recordset (DAO) opened into the
    target table for each one.

    Instr() has a Start argument that you can use to tell it to begin looking
    after the comma you have already parsed. You could try that in an Append
    query, but I suspect it would be more difficult than using Split() in code,
    especially if the number of names in different rows varies.

    Is there any chance of people being duplicated here? i.e. could one person
    be associated with multiple rows? Ultimately, it would seem that you need
    some kind of ClientID table with only one record for each person, and the
    table you are trying to build would then store the ClientID rather than the
    names.

    -- 
    Allen Browne - Microsoft MVP.  Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.
    "Rob" <bccamper@hotpop.com> wrote in message
    news:042501c46e0c$2754fa80$a501280a@phx.gbl...
    > I am not exactly new to Access but I am trying something
    > that is a little over my head. I have a form where I
    > input a series of first names in a field called FirstName
    > seperated by commas (eg Rob, Jim, Susan), and a series of
    > last names entered in a field called LastName seperated
    > by commas (eg Guest, Everett, Wills). I want to match the
    > first, second, etc names in each field and for each pair
    > insert a record into a different table (eg record 1 - Rob
    > Guest, record 2 - Jim Everett, record 3 - Susan Wills).
    > How should I do this? Should I be using an append query,
    > a macro, or do i need to use VBA to do it. I tried an
    > append query but could only use left and instr to get the
    > first name.
    

  • Next message: Roy: "Atribute values by position on Query..."

    Relevant Pages

    • looping thru a fields values
      ... that is a little over my head. ... by commas. ... insert a record into a different table (eg record 1 - Rob ... append query but could only use left and instr to get the ...
      (microsoft.public.access.queries)
    • Re: extract items from list in single field, revisited
      ... the resulting array would have a null element at ... Set rst = Currentdb.OpenRecordset ... would call an append query using Midto unpack the status block into the ... I need to create a table that lists each item singly on a record. ...
      (microsoft.public.access.modulesdaovba)
    • Re: extract items from list in single field, revisited
      ... the resulting array would have a null element at ... Set rst = Currentdb.OpenRecordset ... would call an append query using Midto unpack the status block into the ... I need to create a table that lists each item singly on a record. ...
      (microsoft.public.access.modulesdaovba)
    • Re: System call not acting as expected
      ... > perldoc -f system ... Why are you using commas there ... > logfile_dirs into an array, which seems likely, but I don't know your ... > all sorts of fun problems, like having to sort out terminal escape ...
      (comp.lang.perl.misc)
    • Re: tk widget
      ... mb_ser that is another field from an array. ... winfo exist on Done button Frame? ... so when you do a foreach over a string tcl only splits ... > on spaces and the commas become part of each element. ...
      (comp.lang.tcl)