473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Customised buttons

Hi there i have been deeply frustated as last week trying to figure out how to cycle through records on a form based on a query by using images instead of command buttons . I have a customised view next and previous button. the buttons work until they go out of bounds. I am trying for example to bring the user back to the first record if the user is about to go out of the records range by pressing the next button and to the last record if the user presses the previous button and is about to go past the first record. I am only a novice user and have been playing around with recordset still me fingers have blisters. Can anyone please help me or point me in the right direction.
Apr 8 '08 #1
3 1160
missinglinq
3,532 Expert 2GB
I use this code for these navigation buttons. My forms are always set up with AllowAdditions set to No (I use a custom Add button as well) so at the end of the recordset Access errors out and triggers the code. You'll need to change the button names with your own, of course.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Go2Next_Click()
  2.  
  3. On Error GoTo Err_Go2Next_Click
  4.  
  5. DoCmd.GoToRecord , , acNext
  6.  
  7. Exit_Go2Next_Click:
  8.  
  9. Exit Sub
  10.  
  11. Err_Go2Next_Click:
  12.  
  13. If Err.Number = 2105 Then
  14.  
  15. DoCmd.GoToRecord , , acFirst
  16.  
  17. Else
  18.  
  19. MsgBox Err.Description
  20. Resume Exit_Go2Next_Click
  21.  
  22. End If
  23.  
  24. End Sub
  25.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub Go2Prev_Click()
  2. On Error GoTo Err_Go2Prev_Click
  3.  
  4. DoCmd.GoToRecord , , acPrevious 
  5.  
  6. Exit_Go2Prev_Click:
  7.  
  8. Exit Sub
  9.  
  10. Err_Go2Prev_Click:
  11.  
  12. If Err.Number = 2105 Then
  13.  
  14. DoCmd.GoToRecord , , acLast
  15.  
  16. Else
  17.  
  18. MsgBox Err.Description
  19. Resume Exit_Go2Prev_Click
  20.  
  21. End If
  22.  
  23. End Sub
Welcome to bytes!

Linq ;0)>
Apr 8 '08 #2
thank you so much my head was wrecked. tried about 20 different variations including recordsets. Though it would be a lot harder to do. Im still learning lol
Apr 8 '08 #3
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Apr 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: riusbond | last post by:
Hello is there anyway that you can show the customised user/password screen instead of a standard "enter network password" dialog box when a user attempts to access any unauthorised file from...
5
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main...
0
by: mc | last post by:
Any examples how I can customised app.config besides using appSettings? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.782...
3
by: Rabbit | last post by:
Hi, I'm having a GridView with Datasource being set from CodeBehind method, its has a "RecID" databound field set as invisible. I want to utilize the "Delete" commandfield, so that on...
4
by: Ron | last post by:
I want to create 10 buttons on a form at runtime, the code below is only creating one button labeled 1. Any idea what I am doing wrong? Public Class Form1 Public code(10) As String Public...
3
by: Ron | last post by:
Can anyone help me out? I am trying to add buttons numbered one through 10 at runtime to a form. I think they are getting added but they seem to be getting stacked one on top of each other. so...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
0
by: Kieran | last post by:
I've created a few simple webparts and they work fine. I have now created a customised TreeView webpart (it is populated by a xml file description of a directory on disk). It renders okay but...
9
by: shiks1305 | last post by:
Hi all, I want to submit a form after confirmation through a customised window. I have 4 buttons in <af:form>, one of which is continue button that has to navigate the form to another page while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.