473,661 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display the last records in a table on a continuous form

I want to display the last 22 records in my continuous form. I have
writen the following
code and it works, but was wondering if there were any better
suggestions for accomplishing
this. My code scrolls the screen as it goes to bottom and than scrolls
out the 22 recs.

My code:

Private Sub GoToBottom()
Dim X As Integer
X = 0
If Not ([Form].RecordsetClone .EOF) Then
DoCmd.GoToRecor d , , acLast
If [Form].RecordsetClone .RecordCount 22 Then
For X = 1 To 22
DoCmd.GoToRecor d , , acPrevious
Next
End If
End If
End Sub
Nov 18 '08 #1
4 4871
On Tue, 18 Nov 2008 15:53:53 -0800 (PST), "Greg (co*****@gmail. com)"
<co*****@gmail. comwrote:

You can try this:
Private Sub GoToBottom()
Dim X As Integer
with [Form].RecordsetClone
If Not .EOF Then
'Update RecordCount
.MoveFirst
.MoveLast
If .RecordCount 22 Then
.Move -22
[Form].Bookmark = .Bookmark
End If
End If
End Sub

>I want to display the last 22 records in my continuous form. I have
writen the following
code and it works, but was wondering if there were any better
suggestions for accomplishing
this. My code scrolls the screen as it goes to bottom and than scrolls
out the 22 recs.

My code:

Private Sub GoToBottom()
Dim X As Integer
X = 0
If Not ([Form].RecordsetClone .EOF) Then
DoCmd.GoToRecor d , , acLast
If [Form].RecordsetClone .RecordCount 22 Then
For X = 1 To 22
DoCmd.GoToRecor d , , acPrevious
Next
End If
End If
End Sub
Nov 19 '08 #2
Thanks Tom

Your suggestion worked great! And smooooth response at the screen.

Greg
Nov 19 '08 #3
oops!

Just one little problem. For some reason, when I call this code in the
OnOpen event of the form
it does not always work. It seems that the code gets run before the
data is displayed, so becomes ignored.
This happens when the database is started for the first time, however,
if the form is switched from design mode
and then to view mode it works. Strange. The code that I originally
submitted, works in both scenerios, but
I don't like it because it causes a brief screen scroll. Any ideas why
the new suggested code is not executing when
the database first starts up ?

Greg
Nov 19 '08 #4
'I included the following DoCmd statement in the OnOpen event only,
and this worked.

DoCmd.GoToRecor d , , acLast
Call GoToBottom
Thanks Greg
Nov 19 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2618
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only displays the records associated with that ProductID. Basically this is part of a Product Packing Pick System. From my products table, each product has a set default amount of items which
1
9618
by: huela | last post by:
Somehow i have to display the recordset in unbound form When i use the following display the data in recordset to unbound form. I have a question: i can only display the last record data, all previous data are overwrittend. why i can't create the continues form or datasheet display the data line by line. Thanks a lot for the help
3
6658
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & AS Student, activities.activityDescription, studentScores.score FROM groups INNER JOIN (students INNER JOIN (activities INNER JOIN studentScores ON
4
2639
by: vidiot | last post by:
I am trying to create a subform that will display images related to the parent form. The subform is a continuous form as there will be several images that relate to the parent form. I checked Access help and it gave me the following code, which I have adapted for my database and it works well as a SINGLE FORM. Option Compare Database Private Sub Form_Current()
3
3926
by: ApexData | last post by:
I am using a continuous form for display purposes. Above this form, a single record is displayed so that when the user presses my NewButton they can enter a NewRecord which gets added to the continuous form that displays below. Under the NewButton I have these lines of code: Me.AllowAdditions = True DoCmd.GoToRecord , , acNewRec
0
1666
by: Andrew | last post by:
Hi all A quick question which I've not been able to solve from trawling the web. Is it possible to have a control in the detail section of a form set to a default view of "Continuous" which only appears on the last record? I'm thinking of having a form with a subform, and would like the
3
2786
by: Clint Stowers | last post by:
Access 2003 I have a Continuous Form. On Open I force it to go to the Last Record. When the form opens only the last record is shown at the top. To view any of the previous records you must scroll. This give the appearance at first glance that no other records exist. Is there a simple method to populate the form with records and leaving
3
5923
by: Ian | last post by:
I have a form with a sub form, on the continues sub for I want to display some data along with a picture, on the On Current event I have the code: .Picture = Nz() is the name of the picture control, is the name of the text field that holds the path to the jpg. What I want is each record in the sub form to show the associated
46
10073
by: OldBirdman | last post by:
What a mess this question is. I have spent 2 weeks trying to make it concise and clear, and I can't. I do not have the vocabulary for the question. I cannot even TITLE it correctly. Here is my best effort. Conditions: 80,000+ pictures (These are pictures of birds, ID by Species, Sex, Age, etc. (If known)) Hierarchy of folders: Continent->Country->State(if India, Mexico, USA, Canada, & Australia) (No state for other countries) I am...
0
8432
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, 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...
0
8855
Oralloy
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...
0
8758
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 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...
1
6185
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
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();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
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...

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.