Results 1 to 13 of 13
  1. #1
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8

    Go to next record button shows 'new record'

    Dear,

    Form shows record '1 of 1' but i want to use a 'go to next record button' so it would have to say '1 of 673'.


    Now if i click the 'go to next' button it shows me a new record.

    Can anyone help me please?

    Thank you,

    Bregt

    Click image for larger version. 

Name:	2016-12-21 10_45_09-.jpg 
Views:	19 
Size:	91.7 KB 
ID:	26790
    Last edited by bregtvandenbergh; 12-21-2016 at 01:00 PM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    you may have a filter on.
    is the filtler button pressed down on the toolbar?
    did you open the form via criteria with a KeyID?

  3. #3
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    It's not filtered and it is a detail of a form with all the items in it.

    Sorry but it is the first thing i make with access.

  4. #4
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    This is the macro i use to open the detail of a certain item:

    <?xml version="1.0" encoding="UTF-16" standalone="no"?>
    <UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><UserInterfaceMacro For="txtOpen" Event="OnClick"><Statements><Action Name="OnError"/><ConditionalBlock><If><Condition>[Form].[Dirty]</Condition><Statements><Action Name="RunMenuCommand"><Argument Name="Command">SaveRecord</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[MacroError].[Number]&lt;&gt;0</Condition><Statements><Action Name="MessageBox"><Argument Name="Message">=[MacroError].[Description]</Argument></Action><Action Name="StopMacro"/></Statements></If></ConditionalBlock><Action Name="OnError"><Argument Name="Goto">Fail</Argument></Action><Action Name="OpenForm"><Argument Name="FormName">Item Details</Argument><Argument Name="WhereCondition">="[ID]=" &amp; Nz([ID],0)</Argument><Argument Name="WindowMode">Dialog</Argument></Action><ConditionalBlock><If><Condition>Not IsNull([ID])</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">CurrentID</Argument><Argument Name="Expression">[ID]</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition> IsNull([ID])</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">CurrentID</Argument><Argument Name="Expression">Nz(DMax("[ID]",[Form].[RecordSource]),0)</Argument></Action></Statements></If></ConditionalBlock><Action Name="Requery"/><Action Name="SearchForRecord"><Argument Name="ObjectType">Form</Argument><Argument Name="ObjectName">Items</Argument><Argument Name="WhereCondition">="[ID]=" &amp; [TempVars]![CurrentID]</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">CurrentID</Argument></Action></Statements></UserInterfaceMacro></UserInterfaceMacros>

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    1, that is unreadable,
    2, can you not just open the form,then have the user goto the record?
    3, does the above code limit the records?

  6. #6
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    Sorry for the readability,

    when i have to adjust items it is easier to have a next and previous button.

    this is the code i use now:

    Option Compare Database
    Option Explicit


    Private Sub cmdVorigRecord()
    On Error Resume Next
    DoCmd.GoToRecord , , acPrevious
    End Sub


    Private Sub cmdFirst_Click()
    On Error Resume Next
    DoCmd.GoToRecord , , acFirst
    End Sub


    Private Sub cmdLast_Click()
    On Error Resume Next
    DoCmd.GoToRecord , , acLast
    End Sub


    Private Sub cmdNew_Click()
    On Error Resume Next
    DoCmd.GoToRecord , , acNewRec
    End Sub


    Private Sub cmdVolgendRecord()
    On Error Resume Next
    DoCmd.GoToRecord , , acNext
    End Sub


    Private Sub Volgende_Record_Label_Click()


    End Sub


    Private Sub Form_Current()


    End Sub


    Private Sub VolgendeRecord_Label_Click()


    End Sub


    Private Sub VorigRecord_Click()


    End Sub

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The font on your picture is a bit small, but doesn't it say "Gefilterd" at the bottom? My Dutch is pretty nonexistent but I would assume that means that this form has a filter on it!

  8. #8
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    The screenshot was taken when it was filtered. i tried it when the filter was off.

  9. #9
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    sorry indeed the field is filtered. but how can i disable the filtering automatically?

    Thanks

  10. #10
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    When a form has "1 of 1", there are two things I look at:
    1) the form is in "Data Entry" mode
    2) the SQL recordset has criteria, or there is a filter set on the recordset.

    You said you removed a filter... what is the record source?
    Is the form in data entry mode?

  11. #11
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    i still work with macro's.

    so when i open the item detail it says at the bottom 1 of 1 and filtered.
    so i adjusted the macro from:

    --> GoToNextRecord

    to:

    --> Erase all filtres
    --> GoToNextRecord

    this seems to work without any problem.

    then i copied the buttons to my contact detail page.
    here it gives me the error that there is no filter to be removed.
    it doesn't give this error with the item detail page.
    so this is a new problem i encountered.

    BTW i'm verry new to this...

    kind regards

  12. #12
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I don't work with macros so I have no idea how to fix that error. If you convert it to VBA you can add a line at the beginning: On Error Resume Next, this will prevent the error from happening. Maybe you can do this in a macro, I don't know.

  13. #13
    bregtvandenbergh is offline Novice
    Windows 7 32bit Access 2016
    Join Date
    Dec 2016
    Posts
    8
    Now it works like a charm.

    thanks to everybody.

    i wish everyone a merry christmas and a happy newyear.

    kind regards,

    bregt

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

Similar Threads

  1. Replies: 4
    Last Post: 01-12-2016, 02:49 PM
  2. Replies: 1
    Last Post: 04-11-2015, 10:31 AM
  3. Replies: 2
    Last Post: 07-30-2012, 09:18 AM
  4. Replies: 22
    Last Post: 06-12-2012, 10:02 PM
  5. Replies: 4
    Last Post: 07-22-2011, 12:52 PM

Tags for this Thread

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