Hi All,
I am now on the next part of my quest.
I have built my Form, which has used subforms to show my records and what I need to complete as the POL authority.
I am now trying to jazz the form up so I thought of adding a next record and previous record button.
I added two combo boxes called Next_Record and Previous_Button .
I selected code builder and added the following scripts.
Private Sub Next_Record_Cli ck()
Me.POL_Ref.SetF ocus
If (Me.POL_Ref.Lis tIndex = Me.POL_Ref.List Count - 1) Then
Else
Me.POL_Ref.List Index = (Me.POL_Ref.Lis tIndex + 1)
End If
End Sub
Private Sub Previous_Button _Click()
Me.POL_Ref.SetF ocus
If (Me.POL_Ref.Lis tIndex = 0) Then
Else
Me.POL_Ref.List Index = (Me.POL_Ref.Lis tIndex - 1)
End If
End Sub
I go onto the my report screen and press the buttons and nothing happens no error or anything.
I have tried to use the unique number in the POL_Ref field of my form?
I can't see the wood for the trees now.
6 4825
You have, indeed, over complicated things! I think the first thing you need to do is to delete everything you have so far; buttons, comboboxes and code. To do otherwise is only going to confuse things. Place two buttons on your form, naming them Go2Next and Go2Previous. Then place this code behind the appropriate button: - Private Sub Go2Next_Click()
-
On Error GoTo Err_Go2Next_Click
-
-
DoCmd.GoToRecord , , acNext
-
-
Exit_Go2Next_Click:
-
-
Exit Sub
-
-
Err_Go2Next_Click:
-
-
If Err.Number = 2105 Then
-
MsgBox "This is the Last Record"
-
Else
-
MsgBox Err.Description
-
Resume Exit_Go2Next_Click
-
End If
-
-
End Sub
- Private Sub Go2Previous_Click()
-
On Error GoTo Err_Go2Previous_Click
-
-
DoCmd.GoToRecord , , acPrevious
-
-
Exit_Go2Previous_Click:
-
-
Exit Sub
-
-
Err_Go2Previous_Click:
-
-
If Err.Number = 2105 Then
-
MsgBox "This is the First Record"
-
Else
-
MsgBox Err.Description
-
Resume Exit_Go2Previous_Click
-
End If
-
-
End Sub
If the user is at the first record and tries to go to the previous record, a message box will pop up explaining this. If at the last record and the user tries to go to the next record, this, too, will be explained.
Linq ;0)>
LOL thank you so much. I will try this in the morning as I am too tired to see the screen now.
Good call! After 15 years I can tell you, it's almost always counter- productive to attempt programming when you're tired!
Linq ;0)>
Thanks Miss Ingling,
I did the following at it seems to work.
Private Sub Command23_Click ()
On Error GoTo Err_Command23_C lick
DoCmd.GoToRecor d , , acNext
Exit_Command23_ Click:
Exit Sub
Err_Command23_C lick:
MsgBox Err.Description
Resume Exit_Command23_ Click
End Sub
Private Sub Command24_Click ()
On Error GoTo Err_Command24_C lick
DoCmd.GoToRecor d , , acPrevious
Exit_Command24_ Click:
Exit Sub
Err_Command24_C lick:
MsgBox Err.Description
Resume Exit_Command24_ Click
End Sub
LOL Which is basically what you said. Thanks again you are a star.
Glad you got it figured out! Be aware, though, that if, at the beginning or end of your recordset, the user tries to move again, they will get an error message that says "You can't go to the specified record" without any other explanation! Some users find this confusing!
Linq ;0)>
Thank you I will try to change it then.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Megan |
last post by:
Hi everybody-
I inherited a database that somehow uses a bound combo box as a record
selector. Let me give you some background. The form is based on data
from 2 tables. The first table, Person, records info about a person.
The second table, Case, records information about a person's case,
almost like a human resources database.
The primary key of the table, person, is his/ her social security
number. The primary key of the other...
|
by: AA Arens |
last post by:
Hi,
I have a database with 2 main forms. Contacts and companies. I share
the base with two others via LAN. On the companies form I have buttons
to navigate throught the records
(>400). We are mostly handling let say 5 companies. Every time I have
to navigate or choose the find record button to get the right company.
I am looking fo a feature to have listed in a combo list the last 5
visited records ("recently visited records").
|
by: gjoneshtfc |
last post by:
Hello
I want to search my database for a vehicle registration number but
before i can search using the Find Record button i created i have to
click in the registration field so that it is that one that is being
searched. Is there any way to just click the button and by default it
searches the registration field?
Or... is there a way where I can get the user to type in the
registration number in a text field then click a command button...
|
by: foothills bhc |
last post by:
I have a problem with verifying content of controls on a form before closing the form or moving to the next form "record" (i.e., when moving to the next row of my form's record source).
HERE'S THE LONG EXPLANATION OF THE PROBLEM
First, A Description of the Form:
I have developed a form for entering survey questionnaire data. The data to be entred on the form could be considered as two kinds of information.
One kind could be called...
|
by: mf193 |
last post by:
Hi,
I have a table of around 1000 rows; patient records. Each row is
individually defined by a Patient ID number which is my primary key.
I have made a simple form to display patient information for the
secretaries working in the office. I would like them to be able to
easily search through all the records using a combo box, that they can
just type in the person's name. I have managed to make it work so far
as when the last name is...
| |
by: AppDev63 |
last post by:
I've been struggling with a form. On the left side of the form I've got data from a table of invoices, and on the right side I've got a combo box with data from a table of payments. The user scrolls through the invoices on the left and matches each one up with a payment from the combo box on the right. The common field is an order number, but the relationship between invoices and payments must be created manually by the user matching up the...
|
by: banderson |
last post by:
Hello,
I have a form and a combo box that I use to filter the form to particular records. I also have an "add new" button that, when clicked, adds a new record. My problem is that the filter combo box stays on the old selection when the new record pops up. I would like to have the combo box clear or set to a default value of "New" when the Add New button is clicked or when the user clicks on the * (new record) button in the navigation bar.
...
|
by: Coll |
last post by:
I'm working on a database that someone else created. I have a form -
frm_main that is based on a query that is based on two tables. The
join is such that the first table tbl_JCN has all records included in
the query, but the second table tbl_SOC only has matching records
displayed. On the form (frm_main), there is a combo box - you can
make a selection and the form filters to display that record. There is
also a delete record button. When...
|
by: solargovind |
last post by:
Hello,
I have few problem with Dlookup condition. I need to retrieve next record or previous record based on certain condition. The conditions are set in in the combo box. Here, I am trying to display the records in the text box based on my selection. I have given my selection in the combo box.
For example from the student table, I am trying to display as below...
a). Who are all coming from "Newyork" city in the 7th standard class. ...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |