Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Re: update all filtered records in a sum form

Discussion in 'Information Technology' started by Simon, Jul 28, 2006.

  1. Simon

    Simon
    Expand Collapse
    Guest

    Hi Arvin,
    Thanks for your response.
    Can you tell me what I need to use where you have entered "Whatever" in your
    code. I assumed it would be the name of the sub form followed by the field
    but I don't know how to refer to that with the options provided.
    Also I assume where you have written "Me.txtWhatever" this is the name of
    the control on the main form ?
    Thank you

    "Arvin Meyer [MVP]" wrote:

    > Looks like I forgot to loop:
    >
    > Sub txtWhatever_AfterUpdate()
    >
    > Dim db As DAO.Database
    > Dim rst As DAO.Recordset
    > Set db = CurrentDb
    > Set rst = Me.RecordsetClone
    > Do Until rst.EOF
    > With rst
    > .MoveFirst
    > .Edit
    > .Whatever = Me.txtWhatever
    > .Update
    > .MoveNext
    > End With
    > Loop
    > rst.Close
    > Set rst = Nothing
    > Set db = Nothing
    > Me.Refresh
    >
    > End Sub
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    >
    > "Arvin Meyer [MVP]" <a@m.com> wrote in message
    > news:Ol7qbGccGHA.4900@TK2MSFTNGP02.phx.gbl...
    > > "Simon" <Simon@discussions.microsoft.com> wrote in message
    > > news:E61E49AA-DC0D-4D26-921B-6AF993A93294@microsoft.com...
    > > > I am using Access 2003 and have a form based on 1 table, with a subform

    > > based
    > > > on another. Typically the sub form which is continuous contains 1-6

    > > records.
    > > > I want to be able to update a date field on the main form which then

    > > updates
    > > > a date field in all filtered records of the sub form. I have tried doing

    > > this
    > > > using the after update event on the field in the main form but this only
    > > > updates the sub form record which has the focus. Any suggestions would

    > be
    > > > most appreciated.

    > >
    > > I have no way to test this but it should work for you:
    > >
    > > In the AfterUpdate event of the textbox that you want to change, build a
    > > recordset based on the form's recordsetclone. (air code):
    > >
    > > Sub txtWhatever_AfterUpdate()
    > >
    > > Dim db As DAO.Database
    > > Dim rst As DAO.Recordset
    > > Set db = CurrentDb
    > > Set rst = Me.RecordsetClone
    > > With rst
    > > .MoveFirst
    > > .Edit
    > > .Whatever = Me.txtWhatever
    > > .Update
    > > .MoveNext
    > > End With
    > > rst.Close
    > > Set rst = Nothing
    > > Set db = Nothing
    > > Me.Refresh
    > >
    > > End Sub
    > > --
    > > Arvin Meyer, MCP, MVP
    > > Microsoft Access
    > > Free Access downloads
    > > http://www.datastrat.com
    > > http://www.mvps.org/access
    > >
    > >

    >
    >
    >
     
  2. Loading...

    Similar Threads Forum Date
    Self Update On The Gurdwara Blogs Apr 3, 2017
    Sikh News BREAKING: Young Sikh Shot Dead In Jalalabad, Afghanistan . - Sikh24 News & Updates Breaking News Oct 2, 2016
    update Blogs Oct 16, 2015
    Update Wikipedia enteries on Sikh Socio-Political Topics Breaking News Jul 19, 2015
    Pacific Oil slicks spotted in search for missing Malaysia Airlines plane (Live updates) Breaking News Mar 8, 2014

Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page