Results 1 to 6 of 6
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    advance to the next record in a subform

    i have a subform which displays images (one at a time) that are related to the parent


    the image record has a field indicating whether they are "a detail" or not
    the default sort order is to show all of the details first (one at a time)
    (the user has a "next"and "previous" buttons to scroll through all of the records / images

    some users don't want to see the "detail" images first, they want to start with the "not detail" images
    then be able to "previous" back to the 'details' (if there are any) (and then continue to "next / previous" in the usual manner)

    i though, base on a variable SkipPastDetailsYN, i could set up code to do exactly that

    but instead of advancing through the records of the subform, it is advancing through records of its parent

    any suggestions will be greatly appreciated in advance,
    m.

    Code:
     If DCount("[type]", "tbeAdditionalPages", "[type]= '" & Me.Type & "'") > 0 Then
            If Len(Me.txtCatalogSheetLink) > 0 Then
                vlink = Mid(Me.txtCatalogSheetLink, 2, Len(Me.txtCatalogSheetLink) - 1)
                
                
    'this is the code that i am having troubles with:
                If Me.IsMountingDetail And blnSkipPastDetailsYN = True Then
    
    'tried adding
    '                me.setfocus 
    'without sucess...
    
                    DoCmd.GoToRecord , , acNext
                End If

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    if this code is on the main form then instead of Me. you use nameofsubformcontrol.form.

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    it's in the Current event of the subform
    Code:
    Private Sub Form_Current()

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Can you please try this:
    Code:
    
    Dim vBookmark,rst as Dao.Recordset
    
    
    If blnSkipPastDetailsYN = True Then
    	'skip to the non-detail
    	Set rst=Me.RecordsetClone
    	rst.FindFirst "[IsMountingDetail]= False"
    	if rst.NoMatch then GoTo Exit_Skip
    	vBookmark=rst.Bookmark
    	'navigate to first non-edtail record
    	Me.Bookmark=vBookmark
    End If
    
    
    Exit_Skip:
    set rst=Nothing
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    YEA !
    (I think)

    (seems to have kicked the problem somewhere else... but i'm fairly certain that's an issue of logic (my logic), and not code...) THNX

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    You should put the code in a different event, I would say the Current event of the main form (and you will have to adjust it accordingly to replace Me with a reference to the subform like in Me.sfrmName.Form).

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 6
    Last Post: 08-22-2012, 03:24 AM
  2. Replies: 1
    Last Post: 09-28-2011, 01:17 PM
  3. advance search record
    By miziri in forum Programming
    Replies: 4
    Last Post: 08-24-2011, 11:06 AM
  4. Advance to next row in report
    By jgelpi16 in forum Reports
    Replies: 2
    Last Post: 01-29-2011, 10:40 PM
  5. Replies: 3
    Last Post: 02-19-2010, 04:19 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