Editting multiple records at once using code

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

    Editting multiple records at once using code

    Hi all,

    I'm bothered with this question for weeks now.... Is it possible to edit
    multiple records at once using VBA? I have this continuous form and
    depending on the selection the user makes, I want to edit another table
    (not the recordsource of the form) in my database. How can I access the
    selected records in VBA? Any ideas would be very welcome....

    Thanks in advance,

    Wim

  • Allen Browne

    #2
    Re: Editting multiple records at once using code

    Yes: you can Execute an Update query statement, or OpenRecordset and edit
    the record(s) in the other table(s).

    The question arises as to why you would want to do that. Logging something
    would be a good reason. Storing dependent data in another place would
    probably not be a good reason.

    --
    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.

    "Wim Verhavert" <wim_verhavert@ yahoo.com> wrote in message
    news:1069837308 .813113@seven.k ulnet.kuleuven. ac.be...[color=blue]
    >
    > I'm bothered with this question for weeks now.... Is it possible to edit
    > multiple records at once using VBA? I have this continuous form and
    > depending on the selection the user makes, I want to edit another table
    > (not the recordsource of the form) in my database. How can I access the
    > selected records in VBA? Any ideas would be very welcome....[/color]


    Comment

    • Wim Verhavert

      #3
      Re: Editting multiple records at once using code

      Allen Browne wrote:[color=blue]
      > Yes: you can Execute an Update query statement, or OpenRecordset and edit
      > the record(s) in the other table(s).
      >
      > The question arises as to why you would want to do that. Logging something
      > would be a good reason. Storing dependent data in another place would
      > probably not be a good reason.
      >[/color]

      I don't quite follow you there. How do I make a distinction between a
      selected record and a not-selected one. I can't specify the rules for
      filtering the records. So for example if the form consists of let's say
      350 records, the user can select for example 10 of them (I don't know
      which one), pushes a button and then all the selected records are
      altered, not the other ones. How can I figure out which where the ones
      that he selected?

      Comment

      • Allen Browne

        #4
        Re: Editting multiple records at once using code

        Presumably you have some field (primary key) that uniquely identifies a
        record in the form? If only one record is selected, you can just refer to
        that field, and it will have the value of the current record.

        In a continuous form or datasheet, the user can select multiple contiguous
        records. SelTop and SelHeight will let you identify the selection.

        --
        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.

        "Wim Verhavert" <wim_verhavert@ yahoo.com> wrote in message
        news:1069855048 .296209@seven.k ulnet.kuleuven. ac.be...[color=blue]
        > Allen Browne wrote:[color=green]
        > > Yes: you can Execute an Update query statement, or OpenRecordset and[/color][/color]
        edit[color=blue][color=green]
        > > the record(s) in the other table(s).
        > >
        > > The question arises as to why you would want to do that. Logging[/color][/color]
        something[color=blue][color=green]
        > > would be a good reason. Storing dependent data in another place would
        > > probably not be a good reason.
        > >[/color]
        >
        > I don't quite follow you there. How do I make a distinction between a
        > selected record and a not-selected one. I can't specify the rules for
        > filtering the records. So for example if the form consists of let's say
        > 350 records, the user can select for example 10 of them (I don't know
        > which one), pushes a button and then all the selected records are
        > altered, not the other ones. How can I figure out which where the ones
        > that he selected?
        >[/color]


        Comment

        Working...