Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Event before moving to the next record on a form?

    What's the event before moving to a next record on a form? I was hoping to update the form on the last moment the user moves away from it and moves to the next record.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you mean to set a "last updated by" type of field, typically done in the before update event.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by pbaldy View Post
    If you mean to set a "last updated by" type of field, typically done in the before update event.
    Not sure what you mean.

    User Bob clicks next record and as he does it saves all the details he entered into the unbound text fields before moving to the next record.

    I'd like to make that happen...

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Why unbound?

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try the form before update event or maybe the form after update event.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    A record is committed to table when:

    1. close form

    2. move to another record

    3. run code

    Option 2 applies when user Bob clicks next record. If there were edits on the record then the BeforeUpdate and AfterUpdate events will fire. Code in the BeforeUpdate event can save data from the unbound controls.

    I am also curious as to why the controls are unbound.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    A record is committed to table when:

    1. close form

    2. move to another record

    3. run code

    Option 2 applies when user Bob clicks next record. If there were edits on the record then the BeforeUpdate and AfterUpdate events will fire. Code in the BeforeUpdate event can save data from the unbound controls.

    I am also curious as to why the controls are unbound.
    I coded an unbound to:

    pull the text into a field of tableA
    pull in the ID of the record into a field in tableA
    Time stamp into a field of tableA
    Date stamp into a field of tableA
    user stamp into a field of tableA

    (VBA)

    this way I can tract individual posts of the record from the users rather than using a memo field.

    I also have a unbound textbox 2 that lists the records as one long string (with new lines between)

    each record pulls the data and displays it in that unbound textbox 2 for the corresponding ID

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    In order for the user to enter data into the record using that unbound text box they have to press return. I would also like it if they don't happen to press return and just move to a another record

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I don't understand why you couldn't do what you want with a bound form.

    Date/time stamp could be achieved with default value Now.
    Depending on How RecordId is calculated/assigned, it could be automated.
    A login screen whereby User and privileges were determined could be used to update/assign User stamp to field.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Is this Form completely Unbound? Or are their merely some Controls on it that are Unbound?

    If it is [B]completely Unbound, there really is no 'other Record' to move to, and I don't believe the normal Form events will ever fire. And note that there is nothing you've listed, in Post #7, that cannot be done using a Bound Form and it's Form_BeforeUpdate event, as suggested.

    Linq ;0)>

  11. #11
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Missinglinq View Post
    Is this Form completely Unbound? Or are their merely some Controls on it that are Unbound?

    If it is [B]completely Unbound, there really is no 'other Record' to move to, and I don't believe the normal Form events will ever fire. And note that there is nothing you've listed, in Post #7, that cannot be done using a Bound Form and it's Form_BeforeUpdate event, as suggested.

    Linq ;0)>
    To clarify - the form have unbound and unbound text boxes. I wanted the behaviour of a subform without having to use a subform so I made an unbound text box load the records of another table and another to enter in new data.

    It's when they haven't pressed return and move to the next record that I want an event to fire so that the data saves (almost like pressing enter as you click to next record on the next record icons at the bottom left of the form).

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Some event must occur. Each control has BeforeUpdate and AfterUpdate events.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Some event must occur. Each control has BeforeUpdate and AfterUpdate events.
    It's about moving to the next record. Down the bottom left hand side of the form.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	26 
Size:	3.7 KB 
ID:	18600

    I want something to happen with you click next record here.

    i.e. before you move to the next record, the form fires off events A,B or C.

  14. #14
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    This doesn't really clarify anything:

    Quote Originally Posted by Ruegen View Post

    ...To clarify - the form have unbound and unbound text boxes...
    Did you actually mean:

    Quote Originally Posted by Ruegen View Post

    ...the form have bound and unbound text boxes...
    If the Form is Bound, and I'm guessing, by the attached graphic showing an active Record-selector, then

    Form Events, moving from one Record to another are

    1. Form_Current
    2. Form_BeforeUpdate
    3. Form_AfterUpdate
    4. Form_Current

    Linq ;0)>

  15. #15
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by Missinglinq View Post
    This doesn't really clarify anything:



    Did you actually mean:



    If the Form is Bound, and I'm guessing, by the attached graphic showing an active Record-selector, then

    Form Events, moving from one Record to another are

    1. Form_Current
    2. Form_BeforeUpdate
    3. Form_AfterUpdate
    4. Form_Current

    Linq ;0)>
    I come back to this one because it has come up again as an issue.

    Currently to close a particular form (yes bound and unbound controls) I prevent the user from closing the form using the OnUnload which works great preventing the user from closing the form if certain fields have not yet been completed but this is only for when closing the form and not for moving to the next record when the form is in single form.

    With the current event I check for things like if it is a theatre booking it changes colour, if the date is too old it locks etc etc etc etc

    however I want to prevent the user moving from one record to the other without causing a conflict with my current event functions.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 10-29-2014, 03:49 PM
  2. Replies: 3
    Last Post: 09-19-2012, 07:34 AM
  3. Moving to next/previous record in a form.
    By ser01 in forum Programming
    Replies: 3
    Last Post: 08-07-2012, 06:11 PM
  4. Moving to new record from a different form
    By liam_898 in forum Forms
    Replies: 12
    Last Post: 05-05-2012, 12:34 PM
  5. moving between subforms using wrong event?
    By jmoore in forum Programming
    Replies: 8
    Last Post: 08-02-2011, 11:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums