Results 1 to 4 of 4
  1. #1
    dsajones is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2012
    Posts
    19

    Next Record Button on Parent Form

    Hi. I haven't done any Access forms work in a very long time! I have a simple database with a master record in table A and child records in table B in a one to many relationship. You could think of it as a basic orders DB with order header table and order lines. The database has the relationship set up.

    I've created a simple form using the form wizard with fields from the parent table and then a sub form with the child records. This has worked fine and when I view a record I get the correct parent record linked with all the correct child records showing in the sub form.

    I've added a button to allow the user to move to the next record in the parent table. This has been done using the default macro assignment to the button using Record Navigation - GoToNextRecord. This button has been placed on the parent form.

    When I click it , the view doesn't change to the next parent record until I've clicked it a number of times equal to the number of linked child records e.g. parent record has 4 child records. So I have to click it 4 times before the view changes to the next parent record.

    I've tried going in to the embedded macro properties and found nothing in there except "Record" - Next in the GoToRecord section. So I added Object Type = Table and Object Name = parent table name, Record = Next, Offset = 1. But this does nothing at all i.e. when I click it now absolutely nothing happens no matter how many times I click it.

    I know this is going to be a stupidly simple and obvious answer but It's got me stumped at the moment.

    Thanks in advance for all help

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    If you have record tools on bothe the master form and the sub form, then it's possible the master could be filtered.
    is the FILTER button (on the toolbar) pushed in? If so, then you cannot change records if 1 record is filtered.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I don't use macros,but it sounds like something needs to be refreshed when the button on parent to go to next record is clicked.
    Your description is suggesting that it is processing all records in the related subform before the button click action is executed???
    Can you post a copy of your database and describe how to get to a specific record to see the "issue"?
    Good luck.

    UPDATE:

    I mocked up a situation with Mainform (Authors) and SubForm (AuthorBooks) with a button on the mainform to
    Go To Next MainForm record. This is done with vba, but works as expected. It does not iterate/process each subform
    record before going to next mainform record.

    vba code associated with the button click event

    Code:
    ' ----------------------------------------------------------------
    ' Procedure Name: btnGetNext_Click
    ' Purpose: Demo of buttom on main form that when clicked
    '          goes to next  main form record. If at the end
    '          of the main form recordsource, present a message
    '          saying "no more records"
    ' Procedure Kind: Sub
    ' Procedure Access: Private
    ' Author: Jack
    ' Date: 27-Nov-19
    ' ----------------------------------------------------------------
    Private Sub btnGetNext_Click()
    
    10        On Error GoTo btnGetNext_Click_Error
    20        DoCmd.GoToRecord , , acNext
    30        On Error GoTo 0
    40        Exit Sub
    
    btnGetNext_Click_Error:
    50        If Err.Number = 2105 Then
    60            MsgBox "There are no more Author records", vbOKOnly
    70        Else
    80            MsgBox "Error " & Err.Number & " (" & Err.Description _
                & ") in procedure btnGetNext_Click, line " & Erl & "."
    90        End If
    End Sub
    Here's a screen capture showing message when attempting to go beyond the last Author record.

    Click image for larger version. 

Name:	MainFormBtnToGetNextRecord.PNG 
Views:	21 
Size:	39.5 KB 
ID:	40332
    Last edited by orange; 11-28-2019 at 06:19 AM. Reason: displayroutine header info

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    When you created the macro you chose the wrong form to assign the record move? Just a shot in the dark....
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 17
    Last Post: 07-21-2023, 12:09 AM
  2. Replies: 3
    Last Post: 07-31-2019, 06:27 PM
  3. Replies: 2
    Last Post: 07-21-2018, 08:13 AM
  4. Replies: 5
    Last Post: 05-10-2014, 12:25 PM
  5. run button on parent form
    By Mclaren in forum Programming
    Replies: 4
    Last Post: 04-28-2010, 01:20 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