Results 1 to 5 of 5
  1. #1
    Middlemarch is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    365

    Understanding Form Recordset

    Code:
    Private Sub Form_Current()
        Dim zz  As DAO.Recordset
        Set zz = Me.Form.RecordsetClone
        Debug.Print zz.Name
        Debug.Print Me.RecordSource
        MsgBox zz!Code & " " & Me!Code
    My question is why is zz!Code different to Me!Code ?



    Both zz.name and me.Recordsource are the same. The name of the Forms query.
    me!Code is the current value of Code, whereas zz.code is the value of Code in the query's first record.

    Shouldn't zz be the current record ?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Me!Code is referring to field in form's dataset.

    zz!Code is referring to field in RecordsetClone object.

    No, zz will not open with focus on same record that has focus on form. Code can loop through recordset without affecting the form.
    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.

  3. #3
    Middlemarch is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2015
    Posts
    365
    Righteeoo, thanks. It was just in another case Recordsetclone *is* the Current Record when Form is a subForm.

    Code:
    Me![subTracks].Form.RecordsetClone

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,941
    Do not do what another member does here all the time.
    Process a recordset, yet still refer to the form controls and wonder why the values are the same all the time.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Quote Originally Posted by Middlemarch View Post
    Righteeoo, thanks. It was just in another case Recordsetclone *is* the Current Record when Form is a subForm.

    Code:
    Me![subTracks].Form.RecordsetClone
    I tested this and recordset cursor is on first record regardless of which record in subform has focus.
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. understanding Access form FE to SQL Server BE
    By erich_18 in forum SQL Server
    Replies: 2
    Last Post: 10-29-2018, 11:18 AM
  2. Replies: 7
    Last Post: 12-03-2016, 07:57 AM
  3. Understanding the Form width property
    By Access_Novice in forum Forms
    Replies: 5
    Last Post: 01-18-2014, 07:03 PM
  4. Replies: 6
    Last Post: 12-03-2013, 11:14 PM
  5. Replies: 2
    Last Post: 03-08-2012, 12:59 PM

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