Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a back button and forward button

Status
Not open for further replies.

at51178

Technical User
Mar 25, 2002
587
US
Hey Guys

I would like to know if there is a way to create a custom back button and forward button in access to go back to the previous form that you were in I know that there is one in the menu that comes with access but I would like to place one on a form.

I must also let you know I would like to create the button so that it works with a form that has a subform associated with it
so for example if I have two buttons on the main form one that says form1 and the other that says form2 and if I click on form1 then the subform's sourceobject is form1 and if I click on form2 then the subfoorm's sourceobject is form2 but if I wanted to go back to form one I would like to be able to click on a back button or forward button if I need to go forward.

Thanks
 
Yes you can but I don't remember the correct syntax, you could look in the help files though.

Something like this for next record

Recordset.Move.Next
Me.Bookmark = Recordset.Bookmark

Like This for previous

Recordset.Move.Previous
Me.Bookmark = Recordset.Bookmark

Like I said just double check the help Files under Recordset

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
I have the code

[red]For the next button[/red]

Private Sub NextRecord_Click()
On Error GoTo Err_NextRecord_Click

DoCmd.GoToRecord , , acNext

Exit_NextRecord_Click:
Exit Sub

Err_NextRecord_Click:
MsgBox "This is the last record", , "No More Records"
Resume Exit_NextRecord_Click

End Sub

[red]For the previous button[/red]

Private Sub PrevoiusRecord_Click()
On Error GoTo Err_PrevoiusRecord_Click

DoCmd.GoToRecord , , acPrevious

Exit_PrevoiusRecord_Click:
Exit Sub

Err_PrevoiusRecord_Click:
MsgBox "This is the first record", , "At First Record"
Resume Exit_PrevoiusRecord_Click

End Sub

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Sorry that didn't work
but I did check the help files and even the internet and couldn't find anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top